Support Topics Documentation Slack YouTube Blog

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.

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

To get deviceIdtoPush use

String deviceIdToPush = Messaging.DEVICE_ID;