I am checking documentation about push notifications with Backendless, but i have some doubts about its general behavior and what i found in documentation:
public void registerDevice( Context context, String GCMSenderID )
public void registerDevice( Context context, String GCMSenderID, String channel )
public void registerDevice( Context context, String GCMSenderID, List<String> channels, Date expiration )
But in Android SDK, registerDevice methods do not need Context param. Is the documentation wrong or do i have and outdated SDK?
What is the correct flow to register a device? Should I check first if i have a current DeviceRegistration with a token? Or do i have to call Backendless.Messaging.registerDevice(gcmSenderID) every time I use the app, regardless if already registered the device?
Is there an “automatic” way to register a device associated to a user? Or associate a specific token to a specific user? Or the only way is to create a field in Users table for the device token and update user with the obtained token? My goal is to register a user´s device and send it a push notification using REST API, but only to that specific user …
Do you have any tutorials or demo codes about how to implement push messaging with Backendless?
This is the value you should use when you target a specific device in a push notification.
As for the sample code, there should be a project included into the SDK and you can also use the Code Generator to create a sample project with this functionality.
I have registered one Android device for notifications. Now i would like to send a test notification using Admin Console, but I always get “Authentication failed” message in screen. I am attaching screenshots.
What is the right way to send a push notification from Admin Console?
I have checked the setup and i was doing it wrong, sorry to bother you. I was saving an Android API key instead of a Server API key. Now i have changed it and tried to send again a test notification to the only device i have registered. I got the OK message in console, but i didn´t receive it in the device.
I have checked that the Android manifest configuration is correct, so i think it is due to the headers field like you said, but i don´t understand very well how do i have to fill it in admin console. Could you please give me an example?
i have made all steps written on the DOC and i have the same problem look to my attachment
I got the OK message in console, but i didn´t receive it in the device.
Hi,
I am trying to publish a message using the snippet that I found, but it’s returning me
BackendlessException{ code: ‘Internal client exception’, message: ‘null’ }
I have performed the following code:
DeliveryOptions deliveryOptions = new DeliveryOptions();
deliveryOptions.setPushPolicy(PushPolicyEnum.ONLY);
deliveryOptions.setPushBroadcast(PushBroadcastMask.ANDROID);
PublishOptions publishOptions = new PublishOptions();
publishOptions.putHeader(“android-ticket-text”, “You just got a push notification!”);
publishOptions.putHeader(“android-content-title”, “This is a title in notification center”);
publishOptions.putHeader(“android-content-text”, “Text of the notification message in the notif. center”);
MessageStatus status = Backendless.Messaging.publish(“Hey Android!”, publishOptions, deliveryOptions);
if (status.getStatus() == PublishStatusEnum.FAILED){
System.out.println("@@ FAILED");
}
else if (status.getStatus() == PublishStatusEnum.PUBLISHED){
System.out.println("@@ PUBLISHED");
}
I have done the code for device registration before the above code. The exception takes me to the line that I have made underline.
I have done the push notification using console na working well, so now I am trying using code.
Hopeful for your kind and quick reply.Thanks in advance.
I have the exact same problem as Jay Joshi. i was also able to send the push notification from the console. Any ideas why the publish method crashes with that internal code?