I cloned the quickstart messaging app and it receives notifications when the app has been removed from background. The step to do so :
- Launch the app
- Remove the app from the recent activity.
Now when I create another project and do the exact same thing as being done in the quickstart messaging app, the notifications do not get delivered when the app has been removed from the recent app tray. In the logs I keep seeing the error.
W GCM : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.example.hello (has extras) }
Everything in my app is same as the quickstart messaging app other than the package. What sorcery is this ? :D
Payload being sent
{
"to": "asdasd....",
"priority": "high",
"notifications": {
"body": "Test body",
"title": "Test title"
},
"data": {
"key1": "value1",
"key2": "value2"
}
}
I am using a php script to send this. Same behavior is observed when sending the payload (without 'data' object) using the fcm console.
I did a adb shell dumpsys package | grep stopped for fcm quickstart and my project.
For quickstart app :
User 0: ceDataInode=7733 installed=true hidden=false suspended=false stopped=false notLaunched=false enabled=0 instant=false
User 999: ceDataInode=0 installed=false hidden=false suspended=false stopped=false notLaunched=false enabled=0 instant=false
For my app:
User 0: ceDataInode=25321 installed=true hidden=false suspended=false stopped=false notLaunched=false enabled=0 instant=false
User 999: ceDataInode=0 installed=false hidden=false suspended=false stopped=true notLaunched=true enabled=0 instant=false
The 2 users I guess is for the admin, and another is guest user. I checked the settings and it does give such option.
For my app the stopped status is true for User 999, even when the app is not installed. However the status is false in case of quickstart app. Not sure why this is happening and whether this is causing the issue.