Backendless Support
 
Answered

My push message is sent more than once

Hi, I have 2 questions. First, I run this code below, for some reason device gets 4 push notifications whenever I run this.

DeliveryOptions deliveryOptions = new DeliveryOptions();

deliveryOptions.addPushSinglecast(deviceIdtoPush);

PublishOptions publishOptions = new PublishOptions();

publishOptions.putHeader( PublishOptions.ANDROID_TICKER_TEXT_TAG, getString( R.string.app_name ) );

publishOptions.putHeader( PublishOptions.ANDROID_CONTENT_TITLE_TAG, getString( R.string.app_name ) );

publishOptions.putHeader( PublishOptions.ANDROID_CONTENT_TEXT_TAG, "Liste Görüntüleme OnayńĪ" );

Backendless.Messaging.publish( "default", Message, publishOptions, deliveryOptions, new BackendlessCallback<MessageStatus>()

{

@Override

public void handleResponse( MessageStatus response )

{

}

@Override

public void handleFault( BackendlessFault fault )

{

}

} );

My second question is I get deviceIdtoPush string from the code below. And sometimes I get device token not device Id from the same code.

Backendless.Messaging.getRegistrations(new AsyncCallback<DeviceRegistration>() {

@Override

public void handleResponse(DeviceRegistration devReg) {

// TODO Auto-generated method stub

GCM_RegisterId=devReg.getDeviceId();

}

@Override

public void handleFault(BackendlessFault arg0) {

// TODO Auto-generated method stub

}

});

Thanks in advance.

Leave a Comment

Comments (2)

photo
1

Hi Onur,

I submitted internal tickets to the dev team so we can investigate it further. I will report back once we know more (either reproduce problem or find a way to make it work properly).

Regards,

Mark

photo
1

To get deviceIdtoPush use

  1. String deviceIdToPush = Messaging.DEVICE_ID;