Developing Push Notifications (C2DM) for Android Vijai Co-Founder Adhish Technologies, Sweet’N’Spicy apps.

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
Advertisements

Outline 1/3 PHA Client 1.Overall Architecture 2.Client PHA Setup 1.Open ADT 2.Edit Android Properties Android API 17 3.Setup Android Virtual Device.
Staying in Sync with Cloud 2 Device Messaging. About Me Chris Risner Twitter: chrisrisner.
Cosc 4755 Android Notifications. There are a couple of ways to notify users with interrupting what they are doing The first is Toast, use the factory.
Cosc 5/4730 Android SMS. A note first Depending on the API level, an import changes because of a deprecated API 3 uses – import android.telephony.gsm.SmsManager;
System broadcasts and services. System broadcast events. EventDescription Intent.ACTION_BOOT_COMPLETEDBoot completed. Requires the android.permission.RECE.
SMS. Short Message Service – Primarily text messages between mobile phones – First one sent December 3, 1982 “Merry Christmas” – In 2008 Approximately.
Club/Student Mobile Device Syncing Last updated : 28 May 2014.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
Mobile Programming Lecture 16 The Facebook API. Agenda The Setup Hello, Facebook User Facebook Permissions Access Token Logging Out Graph API.
Mobile Computing Lecture#08 IntentFilters & BroadcastReceivers.
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android.
Cosc 5/4730 Introduction: Threads, Android Activities, and MVC.
Integrating with Android Services. Introduction  Android has numerous built-in functionality that can be called from within your applications  SMS/MMS.
Using Intents to Broadcast Events Intents Can be used to broadcast messages anonymously Between components via the sendBroadcast method As a result Broadcast.
Cosc 5/4730 Broadcast Receiver. Broadcast receiver A broadcast receiver (short receiver) – is an Android component which allows you to register for system.
Android ICC Part II Inter-component communication.
DUE Hello World on the Android Platform.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
Android Accessing GPS Ken Nguyen Clayton State University 2012.
1 Mobile Software Development Framework: Android 2/28/2011 Y. Richard Yang.
Windows News app uses Notification Hubs Platform Notification Service App back-end Client app.
Cosc 5/4730 Android App Widgets. App Widgets App Widgets are miniature application views that can be embedded in other applications (such as the Home.
Milestone 4 – Final Presentation 1. Overview & Motivation 2 friendizer is a competitive social game based on location that offers an opportunity to meet.
How to Log-in to EPIC for the First Time. to FY 2015 Form 471 Authorized Signer Looks Like:
Building Twitter App Rohit Ghatol. About Me Rohit Ghatol 2.Project 3.Certified Scrum Master 4.Author “Beginning.
FCM Workflow using GCM.
How Your Customers Will Pay Online & by Phone
PAYware Mobile Android Comparison June 2013 For Internal Use Only.
Lecture 2: Android Concepts
Proclaim QuickTouch Overview. Proclaim QuickTouch Login
Intents and Broadcast Receivers Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution.
Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, WEB:
David Sutton SMS TELEPHONY IN ANDROID. OUTLINE  This week’s exercise, an SMS Pub Quiz  Simulating telephony on an emulator  Broadcast Intents and broadcast.
Redmond Protocols Plugfest 2016 Tarun Chopra Accessing APIs through Add-Ins Sr. Escalation Engineer.
How to develop a VoIP softphone in C# that enables SIP Instant Messaging (IM) This presentation describes how to create a softphone in C# that allows you.
Messaging and Networking. Objectives Send SMS messages using the Messaging app Send SMS messages programmatically from within your app Receive and consume.
Cosc 4735 Nougat API 24+ additions.
Mobile Software Development for Android - I397
Tracking device movements
Broadcast receivers.
Android Notifications
Tracking and Booking Taxi
Messaging Unit-4.
Notifications and Services
Reactive Android Development
Mobile Software Development for Android - I397
Firebase Cloud messaging A primer
Android Programming Lecture 9
CIS 470 Mobile App Development
Reactive Android Development
Android Notifications (Part 2) Plus Alarms and BroadcastReceivers
Reactive Android Development
First, use our API Builder at www. apilinkbuilder
Mobile Software Development Framework: Android
SHFC Message Board.
Android Topics UI Thread and Limited processing resources
Neighborhood Communications Workshop
Add to the Coffee Ordering App
How to Download the Firefly Student App to your device
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
CIS 470 Mobile App Development
Android Developer Fundamentals V2
Android Notifications
Android Developer Fundamentals V2 Lesson 5
Hero for Students and Parents: Creating and activating your account
Notifying from the Background
User Segmentation and Targeted Push Notifications for UWP apps
MyLion Registration Website | Mobile device
Mobile Programming Broadcast Receivers.
Presentation transcript:

Developing Push Notifications (C2DM) for Android Vijai Co-Founder Adhish Technologies, Sweet’N’Spicy apps

What is Push Notification?

Without Push Notification

With Push Notification

Flow

Before we start It works on Android SDK You need a Google account Implementing with Device is easier than Simulator

Step 1 Register your address for Google C2DM. signup.html

Step 2 – Manifest Changes Permissions to Send/Receive Messages <permission android:name="com.push.app.permission.C2D_MESSAGE" android:protectionLevel="signature" />

Step 2 – Contd. Receiver for Messages <receiver android:name=".CustomC2DMReceiver" android:permission="com.google.android.c2dm.permission.SEND">

Step 3 – Receiver public class CustomC2DMReceiver extends BroadcastReceiver public void onReceive(Context context, Intent intent) { if (intent.getAction().equals( "com.google.android.c2dm.intent.REGISTRATION")) { handleRegistration(context, intent); } else if (intent.getAction().equals( "com.google.android.c2dm.intent.RECEIVE")) { handleMessage(context, intent); } private void handleRegistration(Context context, Intent intent) { intent.getStringExtra("registration_id"); } private void handleMessage(Context context, Intent intent) { String message = intent.getExtras().getString("payload"); //Display Notification }

Step 4 – Display Notification Process the message and Display Notification NotificationManager manager= (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon,null, System.currentTimeMillis()); Intent notifyIntent = new Intent(Intent.ACTION_MAIN); notifyIntent.setClass(context, Home.class); PendingIntent contentIntent = PendingIntent.getActivity(context, 0,notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT | Notification.FLAG_AUTO_CANCEL); notification.setLatestEventInfo(context, “title", “message”, contentIntent); manager.notify(1, notification);

Step 5 – Ask Registration ID Async Service to get Registration ID Add it to the Launch if (Build.VERSION.SDK_INT >= 8) { Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER"); registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0)); registrationIntent.putExtra("sender", startService(registrationIntent); }

Send Push Notification to the App – Trigged by Server Send HTTP POST to Body : "collapse_key=Push&data.payload=Hi&registration_id=5245rc9e56g648f6.. ” Header : "Authorization: GoogleLogin auth=23232xx ” Google Login Auth Code: UserName -

Best Practices Only right amount of Notifications Option to Opt out Track conversions

Questions Source Code:

App gets Registration ID

Send message from Server

Shows Notification