You need to sign in to do that
Don't have an account?
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);
}
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
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