I released an application in April for which GCM messages where correctly received in foreground and background.
After few modifications in this application, I realized that background notifications were not received anymore whereas it still working in foreground.
After few hours to investigate I didn't see any reason which could explain it so I started back from the project of April.
But after rebuild it, I face the same problem; GCM messages are not received when the application is in background.
I compared both projects with WinMerge and manifest, build.gradle, source files, libs, google-service.json are exactly the same.
The only difference I see is the project level build.gradle because Studio asked me to update it.
Before:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
After:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
And of course, builds are different, so obviously, something in my build environment cause Studio to create a different application code and this one doesn't work well with GCM messages.
Do you have any idea?
app.iml files are different would it be interesting to guess what's wrong?
**Edit**
For the published app, if I receive a message in foreground and then put it in background then swipe it out of the recent apps list, the notification created by the received messages remains in notification center.
For the newly builded project, when I do the same, the notification is immediately removed from the notification center.