[Android] Push background doesn't work?


#1

From the docs

On Android if you want your on(‘notification’) event handler to be called when your app is in the background it is relatively simple.

First the JSON you send from GCM will need to include “content-available”: “1”. This will tell the push plugin to call your on(‘notification’) event handler no matter what other data is in the push notification.

So I’m sending this…

{"to":"LonGkEy",
"notification":
{
"title":"Nuevo mensaje",
"body":"Bla bla bla bla"
},
"data":
{
"id_solicitud":2,
"id_company":7,
"texto":"ola k ase",
"content-aviable":1
}}  

… and nothing happens. If the app is active, then yes, push.on('notification'...) works fine, it’s triggered and process all the data, but in background is totally dead.