Support Topics Documentation Slack YouTube Blog

Android Messaging "Silent" Push Notifications

I remember reading a few months ago that you guys were planning on implementing a “Silent” push notification feature for pub/sub messaging and I was curious if this has been implemented yet. If so is there a tutorial somewhere that discusses how to use this feature?

At the moment it seems that a user can only receive a pub/sub message while the app is active. For my app I need to be able to receive messages while the app is in the background or closed. Using regular push messages would be nice but the inability to unregister a device from a specific channel makes this not an option.

If the “Silent” push messaging feature hasn’t been implemented what is the best practice for a problem like this? The best idea I have so far is to have a background service that executes polling requests every so often which could hurt battery life and cost a lot of api calls.

Thanks,
Stephen

Unfortunately, not yet.
Likely, it is possible in the next major release.

Hi,

I rekindle this post as I couldn’t find any news on this matter.

I wonder if Android silent push notifications are currently available or if there is any workaround to use instead.

I use them on my app iOS version and, it would be great if I could have the same user experience despite the platform they use.

Thank you in advance.

Best regards.
Alejandro

Hello, @Alejandro_Cuartas_Fernandez.
Currently, “silent” push notifications are available for Android too.

Regards, Nikita.

Hi Nikita,

Thank you for your prompt answer.

Could you please give me some piece of advice on how I should adapt my code?

Currently, I have:

PublishOptions opciones = new PublishOptions();
      Map<String,String> cabecera = new HashMap<String,String>() ;
      String conDisp = silencioso ? "1":"0";
      cabecera.put("ios-sound", "alerta.caf");
      cabecera.put("ios-alert-body",mensaje);
      cabecera.put("ios-alert-title", titulo);
      cabecera.put("ios-alert-subtitle", "");
      cabecera.put("ios-badge", "0");
      cabecera.put("ios-content-available", conDisp); 
      cabecera.put("mutable-content", "1");
      cabecera.put("Tipo", tipo);
      cabecera.put("idObjeto", idObjeto);
      cabecera.put("idObjeto2", idObjeto2 );
      opciones.setHeaders(cabecera);
      Backendless.Messaging.publish("default", mensaje, opciones, new AsyncCallback<MessageStatus>() {
             @Override
             public void handleResponse(MessageStatus response) {
             }
             @Override
             public void handleFault(BackendlessFault fault) {
             }
 });

@Alejandro_Cuartas_Fernandez.

Currently, push notifications are available through template creation. All other methods are deprecated and we do not support them.
Push for Android works the same way as for iOS. You need to set the contentAvailable parameter to 1.
However, in this case, our logic will not be supported, and you will have to render the interface and add event handlers on your own.

You can also do this in the console:

Regards, Nikita.