Push notifications received two times

I’m sending push notifications in my android app using Backendless. It works fine but I’m always receiving the same notifications two times.
Here is an example of code with which I send them:

BotInsights insight = new BotInsights();
insight.setMessage("Bravo hai più di 10 insights inviati");
if (user.getProperty("deviceId") != null) {
 String deviceId = user.getProperty("deviceId").toString();
 DeliveryOptions deliveryOptions = new DeliveryOptions();
 PublishOptions publishOptions = new PublishOptions();
 publishOptions.putHeader("android-ticker-text", "Complimenti");
 publishOptions.putHeader("android-content-title", "Complimenti");
 publishOptions.putHeader("android-content-text", "Bravo hai più di 10 insights inviati");
 Backendless.Messaging.publish("Nuovo bot insight", publishOptions, deliveryOptions);

However I think the problem lies somewhere in the receiving of the messages as the message seems to pass in the Console a single time. Here is my manifest where I declared the use of push notifications:

 <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
 <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
 &lt;category android:name=&quot;com.p4i.continuousfeedback&quot;/&gt;
&lt;service android:name=&quot;com.backendless.push.BackendlessPushService&quot;/&gt;

Does anyone have any idea why this happens?
Thanks in advance,

Sorry I’ve just found this other topic which seems the same problem http://support.backendless.com/t/multiple-devices-registered-when-app-is-deleted-and-reinstalled-causing-multiple-push-notifications

Has this multiple registrations problem being solved also for android? (I’m currently using backendless:3.0.25)

It’s strange because even manually deleting the extra registrations on the console it keeps receiving double notifications and because I’m targetting a signle deviceId so it should anyway send it only to the device registered with that id. Any ideas?

If there is only one device id you will get only one notification

If a device is registered twice, it will receive two notifications. When an app is deleted, the backend has no way of knowing that and the devices will not be cleaned up. As a result, in your case, it is recommended to call unregisterDevice when the app runs for the first time.

unregisterDevice doesn’t seem to work. We get this error:

public boolean unsubscribeToPushChannel(final String channel) {
if (!BNetworkManager.sharedManager().getNetworkAdapter().backendlessEnabled())
return false;

       Log.e(“unregisterDevice”,“success “);
   catch( BackendlessException exception )
       // either device is not registered or an error occurred during de-registration
       Log.e(“unregisterDevice”,“fail ” + exception.getMessage());

   return true;


error: =java.lang.IllegalArgumentException: Device is not registered.
at com.backendless.Messaging$3.doInBackground(Messaging.java:283)
at com.backendless.Messaging$3.doInBackground(Messaging.java:274)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

couldn’t call unregisterDevice when the app runs for the first time

Are you able to see the device id in the data service?