Your SlideShare is downloading. ×
0
AndroidCloud2DeviceMessagingCommunicate with yourapp!Mando StamelakiM-STAT – Mobile Application Developer     |       |   ...
Android Cloud to Device Messaging Framework                                                                               ...
AC2DM                                                           Android Cloud to device Messaging, provided free by Google...
coming                     M-STAT Service                                                                                 ...
C2DM communication                                                                            Communication flow between M...
M-STAT Server                                                     HTTP Communication protocol             REGISTER        ...
Preferences                                                   Preferences                                                 ...
Software Development Kit for M-STAT Notification Service                                                   The SDK contain...
SDK                                                   Library                                                   • Implemen...
SDK                                                   Mobile Helping App                                                  ...
Let’s CODE!!!
Start with . . .                                                   adding the Library to your projectMando Stamelaki | And...
Integrate M-STAT’s library                                                                          AndroidManifest.xml (1...
Integrate M-STAT’s library                                                                 AndroidManifest.xml (2 of 2)<ap...
Calling the library                                                                                 Startup class or any c...
Any Questions?
Resources                                                   Resources                                                   1....
Mando Stamelaki         THANK YOUMobile Application Developerm.stamelaki@m-stat.gr          M-STAT | Android Clould2Devic...
Upcoming SlideShare
Loading in...5
×

Android Cloud2Device Messaging

1,245

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,245
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
39
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Android Cloud2Device Messaging"

  1. 1. AndroidCloud2DeviceMessagingCommunicate with yourapp!Mando StamelakiM-STAT – Mobile Application Developer | | |2012 Copyright M-STAT SA
  2. 2. Android Cloud to Device Messaging Framework (AC2DM) What is Android C2DM Framework?Introduction to AC2DM Android Cloud to Device Messaging (C2DM) is – a service that helps developers send data from servers to their applications on Android devices.Google Service for The service provides a:pushing messages to – simple,Android devices. – lightweight mechanism that servers can use to: – tell mobile applications to contact the server directly, – fetch updated application or user data. Push Notifications for The C2DM service handles Android Phones, – all aspects of queuing of messages and Tablets and other – delivery to the target application running on the target devices. device.Mando Stamelaki | Android Cloud2Device Messaging
  3. 3. AC2DM Android Cloud to device Messaging, provided free by Google Servers Advantages Disadvantages• 3rd party application servers send lightweight • C2DM makes no guarantees about delivery messages to their Android applications. or the order of messages.• An application on an Android device doesn’t • Does not provide built-in user interface or need to be running to receive messages. other handling for message data.• Uses an existing connection for Google • Requires devices running Android 2.2 or services, with the set up Google account on higher that also have the Market application mobile device. installed.Mando Stamelaki | Android Cloud2Device Messaging
  4. 4. coming M-STAT Service In the role of 3rd party server soon Server-side Mobile Application Encountering C2DM disadvantages• No need to setup a server in • Easy integration in your • Application ability to inform order to send notification Application M-STAT server when a push messages. message is received • Full documentation for• User friendly environment. developers • Library provides a built-in handler for messages• Cross-platform push • Documented code examples notifications (iOS supported, Windows Phone on the way!) • Easy customizable to your app needs.Mando Stamelaki | Android Cloud2Device Messaging
  5. 5. C2DM communication Communication flow between M-STAT (3rd party server) and Google request register Android registration id Application Servers (Device) (C2DM | Client Login) Push message registration id send id | error [tags] registration id message key id authorization Notification requests Server authorization authorizationMando Stamelaki | Android Cloud2Device Messaging
  6. 6. M-STAT Server HTTP Communication protocol REGISTER • A device for push notifications • Update an existing device CURRENT STATUS • Registration status and tags if any UNREGISTER • Remove a device from the listMando Stamelaki | Android Cloud2Device Messaging
  7. 7. Preferences Preferences • Enable / Disable C2DM service • Register/Unregister from Google • Register/Unregister from M-STAT • Register to specific notification tags • An app can let users receive notifications for specific things (up to each developer) and not everything • Retrieve registration statusMando Stamelaki | Android Cloud2Device Messaging
  8. 8. Software Development Kit for M-STAT Notification Service The SDK contains: • Library • Mobile App • ExamplesMando Stamelaki | Android Cloud2Device Messaging
  9. 9. SDK Library • Implementing the process to register and unregister from Google servers. • Connect to M-STAT’s servers and pass the registration id, and other preferences.Mando Stamelaki | Android Cloud2Device Messaging
  10. 10. SDK Mobile Helping App • Representing the usage of library • Helping developers to test the service without having to implement their own application.Mando Stamelaki | Android Cloud2Device Messaging
  11. 11. Let’s CODE!!!
  12. 12. Start with . . . adding the Library to your projectMando Stamelaki | Android Cloud2Device Messaging
  13. 13. Integrate M-STAT’s library AndroidManifest.xml (1 of 2) <xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="gr.mstat.example" android:versionCode="1" android:versionName="1.0" > <!-- Android 2.2 --> <uses-sdk android:minSdkVersion="8" /> <!-- Permissions --> <permission android:name="gr.mstat.example.permission.C2D_MESSAGE“ android:protectionLevel="signature" /> <uses-permission android:name="gr.mstat.example.permission.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- ... other permissions here ... -->Mando Stamelaki | Android Cloud2Device Messaging
  14. 14. Integrate M-STAT’s library AndroidManifest.xml (2 of 2)<application><!-- ... any activities | services | receivers here ... --> <service android:name="gr.mstat.c2dm.C2DMReceiver" /> <receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <!-- Receive the actual message --> <action android:name="com.google.android.c2dm.intent.RECEIVE"/> <category android:name="gr.mstat.example" /> </intent-filter> <intent-filter> <!-- Receive the registration id --> <actionandroid:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="gr.mstat.example" /> </intent-filter> </receiver></application><!-- ... other code here ... --></manifest>Mando Stamelaki | Android Cloud2Device Messaging
  15. 15. Calling the library Startup class or any class where you want the notification service being initialized Still under “deep thought” but will look to something like…Single line initialization // this refers to a Context object // OPTION 1:Different ways of // Starts up the service according to a preferenceinitialization from application preferences PushNotification.registerAuto(this);Customized preferences // OPTION 2: // Manual register or unregister to the service PushNotification.register(this, true);BUT ALL WITH: PushNotification.register(this, false);As less coding as // OPTION 3:possible!!! // Registration to specific tag notifications ArrayList<String> tags = new ArrayList<String>();Library does the dirty tags.add("tag_name_1");job! // ... any other tags developer wants tags.add("tag_name_v"); PushNotification.register(this, tags); // choose according to your needs!Mando Stamelaki | Android Cloud2Device Messaging
  16. 16. Any Questions?
  17. 17. Resources Resources 1. Google Projects for Android: C2DM http://code.google.com/android/c2dm/ 2. Android Cloud To Device Messaging http://android-developers.blogspot.com/2010/05/android-cloud-to-device- messaging.html 3. Android C2DM Push Notification http://stackoverflow.com/questions/6276342/android-c2dm-push-notification 4. Android C2DM server and client implementation working http://markmelive.com/2011/04/android-c2dm-server-and-client- implementation-working/ 5. C2DM Tutorial Send push notifications to your applications with Android C2DM | Cloud To Device Messaging Tutorial http://www.hightechno.info/2011/08/c2dm-tutorial-send-push-notifications.html 6. Android Cloud to Device Messaging (C2DM) - Tutorial http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html 7. Cloud to device messaging http://www.androidkit.com/cloud-to-device-messagingMando Stamelaki | Android Cloud2Device Messaging
  18. 18. Mando Stamelaki  THANK YOUMobile Application Developerm.stamelaki@m-stat.gr M-STAT | Android Clould2Device Messaging
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×