function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FilikinFilikin 

Anyone seen an Android push notification example

Hi,
now that push notification is on general release, is there a sample native android app that demonstrates it?

I thought I had the code right when an entry appeared i the "Mobile Push Registrations" page, but when I used the test page to send a JSON string to my app, and set a breakpoint in the interface function, the code never got to the function.

Then I refreshed the  "Mobile Push Registrations" page and the entry had disappeared.

My OnCreate code is pretty much a copy and paste from the documentation:

public static MyReceiveNotification mrn = new MyReceiveNotification();

@Override
public void onCreate() {
  super.onCreate();
  SalesforceSDKManager.initNative(getApplicationContext(), new KeyImpl(), MainActivity.class);
  SalesforceSDKManager.getInstance().setPushNotificationReceiver(mrn);
}

Ramu_SFDCRamu_SFDC
See if the below article helps

https://developer.salesforce.com/page/Push_Notifications_for_Salesforce_Mobile_Apps_with_Urban_Airship
https://developer.salesforce.com/docs/atlas.en-us.188.0.mobile_sdk.meta/mobile_sdk/push_using_android.htm
FilikinFilikin
Thanks for the response, unfortunately Urban Airship was the solution before Summer ’14 and the other reference is where I got the sample code I gave in the original post. I can’t find a complete working app that actually uses the push notifications, as opposed to just snippets of code.
Prachi JainPrachi Jain
For push notifications you can do following:
First create a project Google console and noted down the project number. After that enable Google Cloud messaging for android api for that project. After enabling api, you need to create an API key for server. So for that, go to credentails tab and click on create Public access key. then select Server key option. Then copy the generated API key.
For examples, you can use Salesforce mobile sdk sample apps.
In one of the sample app, open bootconfig file, on push notification client id: paste the project number generated from GCM console.
Then on salesforce organization, create a connected app, in that app, enable push notification and select platform, and then paste the API key.
when connected app is created, a consumer key automatically generated. Copy the consumer key and replace that key with remoteAccessConsumerKey. And create class which will implement the PushNotificationInterface and rest steps are well defined in docs.
Hope it'll help you