SlideShare a Scribd company logo
Fernando Cejas - @fernando_cejas
Fernando García - @fegabe
 Introduction
 What’s Push?
 Push vs. Poll
 Cloud to device messaging
 Android Implementation
 Build your app
?
 F.A.Q
 “fastDove Push”
                                  Who   we are?
     App for this demo




   http://bit.ly/ac2dm_sample
Push technology, or server push, describes a style of Internet-
based communication where the request for a given
transaction is initiated by the publisher or central server.




                                Harder to implement
                                Less battery consumption
                                Constant connection
Push me your news!
        Any news?
           No!
        Any news?
           No!
        Any news?
           No!          New            News!
                      content!
        Any news?
        Yes! (News)




 Transfer
         content as soon as available
 Save device battery
 Reduce data traffic for user
 HaIt
     allows third-party application servers to
 send lightweight messages to their Android
 applications

 C2DM  makes no guarantees about delivery or
 the order of messages

 Anapplication on an Android device doesn’t
 need to be running to receive messages
 Itdoes not provide any built-in user interface or
  other handling for message data

 Itrequires devices running Android 2.2 or higher
  that also have the Market application installed

 Ituses an existing connection for Google
  services
1.   Register device for Push   3.   Device receives message
2.   App server send message    4.   Unregister device
 Requesting     a Registration ID

C2DMessaging.register(this, "sender@gmail.com");
 Receiving         the Registration ID

public class C2DMReceiver extends C2DMBaseReceiver {

         public C2DMReceiver() {
                   super("sender@gmail.com");
         }

         @Override
         public void onRegistered(Context context, String registrationId) {
                    // TODO send registration ID to the app server
         }
         ...
}
 Receiving        Messages

public class C2DMReceiver extends C2DMBaseReceiver {
           ...

         @Override
         protected void onMessage(Context context, Intent intent) {

                   String payload = intent.getStringExtra("payload");
                   // TODO handle the message
         }
}
 Android            Manifest
<application>
    ...

     <!-- required for AC2DM -->
     <service android:name="com.fastdove.sample.ac2dm.C2DMReceiver" />

     <receiver
        android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
           <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
           <category android:name="com.fastdove.sample.ac2dm" />
        </intent-filter>
        <intent-filter>
           <action android:name="com.google.android.c2dm.intent.RECEIVE" />
           <category android:name="com.fastdove.sample.ac2dm" />
        </intent-filter>
     </receiver>
     <!-- END required for AC2DM -->

</application>
 Android             Manifest
<application>
    ...

</application>

<!-- required for AC2DM -->
  <permission
     android:name="com.fastdove.notifications.demo.permission.C2D_MESSAGE"
     android:protectionLevel="signature" />

  <uses-permission       android:name="com.fastdove.notifications.demo.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" />

<!-- END required for AC2DM -->
 Request     Authorization Token
$ curl https://www.google.com/accounts/ClientLogin -d
accountType=GOOGLE -d source=Google-cURL-Example -d
service=ac2dm -d Email=sender@gmail.com -d "Passwd=***"

 Send    Message
$ curl --header "Authorization: GoogleLogin auth=authorization_id"
"https://android.apis.google.com/c2dm/send" -d
registration_id=device_registration_id -d "data.payload=your
message" -d collapse_key=something
Android Cloud To Device Messaging
Android Cloud To Device Messaging
http://www.fastdove.com/

@fastdove
@fastdovedev

info@fastdove.com

Fernando Cejas - @fernando_cejas
Fernando García - @fegabe
Say thanks to the people I got
information from:

@johanni
@vogella

More Related Content

PPTX
PPTX
CIS 2015 Mobile SSO
PPTX
Mobile Devices in the Enterprise: What IT needs to know
PPTX
Mobile SSO using NAPPS
TXT
Google api sha1
PPTX
Introduction to google cloud messaging in android
PPT
Google Cloud Messaging
CIS 2015 Mobile SSO
Mobile Devices in the Enterprise: What IT needs to know
Mobile SSO using NAPPS
Google api sha1
Introduction to google cloud messaging in android
Google Cloud Messaging

What's hot (12)

PDF
Mobile SSO: Give App Users a Break from Typing Passwords
PPTX
Kodak - OpenID Retail Summit at PayPal
PPTX
Single sign-on Across Mobile Applications from RSAConference
PPTX
Gcm presentation
PDF
Deep Dive into OAuth for Connected Apps
PDF
Patterns and Practices in Mobile SSO
PDF
Successful Enterprise Single Sign-on: Addressing Deployment Challenges
PPTX
OAuth with Salesforce - Demystified
PDF
Authentication with OAuth and Connected Apps
PPTX
Google cloud messaging
PPTX
Mobile Single-Sign On: Extending SSO Out to the Client - Layer 7's CTO Scott ...
PPTX
GCM with Pushbots
Mobile SSO: Give App Users a Break from Typing Passwords
Kodak - OpenID Retail Summit at PayPal
Single sign-on Across Mobile Applications from RSAConference
Gcm presentation
Deep Dive into OAuth for Connected Apps
Patterns and Practices in Mobile SSO
Successful Enterprise Single Sign-on: Addressing Deployment Challenges
OAuth with Salesforce - Demystified
Authentication with OAuth and Connected Apps
Google cloud messaging
Mobile Single-Sign On: Extending SSO Out to the Client - Layer 7's CTO Scott ...
GCM with Pushbots
Ad

Similar to Android Cloud To Device Messaging (20)

PDF
Android Cloud to Device Messaging Framework at GTUG Stockholm
PDF
FOSS STHLM Android Cloud to Device Messaging
PDF
Android push-applications-android
PPTX
Android Cloud to Device Messaging with the Google App Engine
PPT
Android C2DM Presentation at O'Reilly AndroidOpen Conference
PPTX
GCM Technology for Android
PPTX
AutoMate+
PDF
Android Cloud2Device Messaging
PDF
Push-Notification
PDF
Push to Me: Mobile Push Notifications (Zend Framework)
PDF
Zend Framework Push Notifications
PDF
Mobile Push Notifications
PPTX
google cloud messaging
PPTX
AC2DM For Security
PPTX
google cloud messaging
PDF
Leveraging Zend Framework for Sending Push Notifications
PDF
GCM for Android
PDF
How to Enable Unified Push Notifications in Native and HTML5 Hybrid Mobile Apps
PPTX
Push Notification for Android, iOS & Sever Side Using Firebase Cloud Messaging
Android Cloud to Device Messaging Framework at GTUG Stockholm
FOSS STHLM Android Cloud to Device Messaging
Android push-applications-android
Android Cloud to Device Messaging with the Google App Engine
Android C2DM Presentation at O'Reilly AndroidOpen Conference
GCM Technology for Android
AutoMate+
Android Cloud2Device Messaging
Push-Notification
Push to Me: Mobile Push Notifications (Zend Framework)
Zend Framework Push Notifications
Mobile Push Notifications
google cloud messaging
AC2DM For Security
google cloud messaging
Leveraging Zend Framework for Sending Push Notifications
GCM for Android
How to Enable Unified Push Notifications in Native and HTML5 Hybrid Mobile Apps
Push Notification for Android, iOS & Sever Side Using Firebase Cloud Messaging
Ad

More from Fernando Cejas (15)

PDF
The Mayans Lost Guide to RxJava on Android
PDF
It is about philosophy: culture of a good programmer
PDF
Material Design for Old Schoolers
PDF
How to Become the MacGyver of Android Custom Views
PDF
Android UX-UI Design for Fun and Profit
PDF
How ANDROID TESTING changed how we think about Death - Second Edition
PDF
How ANDROID TESTING changed how we think about Death
PDF
Dinosaurs and Androids: The Listview Evolution
PDF
Inside Android Testing
PDF
Webview: The fifth element
PPTX
Nfc on Android
PPTX
Android Design Patterns
PPTX
Android Quick Introduction
PPT
Desarrollo android almacenamiento de datos
PPTX
Android simple 2d Layout animation
The Mayans Lost Guide to RxJava on Android
It is about philosophy: culture of a good programmer
Material Design for Old Schoolers
How to Become the MacGyver of Android Custom Views
Android UX-UI Design for Fun and Profit
How ANDROID TESTING changed how we think about Death - Second Edition
How ANDROID TESTING changed how we think about Death
Dinosaurs and Androids: The Listview Evolution
Inside Android Testing
Webview: The fifth element
Nfc on Android
Android Design Patterns
Android Quick Introduction
Desarrollo android almacenamiento de datos
Android simple 2d Layout animation

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Review of recent advances in non-invasive hemoglobin estimation
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Modernizing your data center with Dell and AMD
NewMind AI Weekly Chronicles - August'25 Week I

Android Cloud To Device Messaging

  • 1. Fernando Cejas - @fernando_cejas Fernando García - @fegabe
  • 2.  Introduction  What’s Push?  Push vs. Poll  Cloud to device messaging  Android Implementation  Build your app ?  F.A.Q
  • 3.  “fastDove Push”  Who we are? App for this demo  http://bit.ly/ac2dm_sample
  • 4. Push technology, or server push, describes a style of Internet- based communication where the request for a given transaction is initiated by the publisher or central server.  Harder to implement  Less battery consumption  Constant connection
  • 5. Push me your news! Any news? No! Any news? No! Any news? No! New News! content! Any news? Yes! (News)  Transfer content as soon as available  Save device battery  Reduce data traffic for user
  • 6.  HaIt allows third-party application servers to send lightweight messages to their Android applications  C2DM makes no guarantees about delivery or the order of messages  Anapplication on an Android device doesn’t need to be running to receive messages
  • 7.  Itdoes not provide any built-in user interface or other handling for message data  Itrequires devices running Android 2.2 or higher that also have the Market application installed  Ituses an existing connection for Google services
  • 8. 1. Register device for Push 3. Device receives message 2. App server send message 4. Unregister device
  • 9.  Requesting a Registration ID C2DMessaging.register(this, "sender@gmail.com");
  • 10.  Receiving the Registration ID public class C2DMReceiver extends C2DMBaseReceiver { public C2DMReceiver() { super("sender@gmail.com"); } @Override public void onRegistered(Context context, String registrationId) { // TODO send registration ID to the app server } ... }
  • 11.  Receiving Messages public class C2DMReceiver extends C2DMBaseReceiver { ... @Override protected void onMessage(Context context, Intent intent) { String payload = intent.getStringExtra("payload"); // TODO handle the message } }
  • 12.  Android Manifest <application> ... <!-- required for AC2DM --> <service android:name="com.fastdove.sample.ac2dm.C2DMReceiver" /> <receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.fastdove.sample.ac2dm" /> </intent-filter> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.fastdove.sample.ac2dm" /> </intent-filter> </receiver> <!-- END required for AC2DM --> </application>
  • 13.  Android Manifest <application> ... </application> <!-- required for AC2DM --> <permission android:name="com.fastdove.notifications.demo.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.fastdove.notifications.demo.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" /> <!-- END required for AC2DM -->
  • 14.  Request Authorization Token $ curl https://www.google.com/accounts/ClientLogin -d accountType=GOOGLE -d source=Google-cURL-Example -d service=ac2dm -d Email=sender@gmail.com -d "Passwd=***"  Send Message $ curl --header "Authorization: GoogleLogin auth=authorization_id" "https://android.apis.google.com/c2dm/send" -d registration_id=device_registration_id -d "data.payload=your message" -d collapse_key=something
  • 18. Say thanks to the people I got information from: @johanni @vogella