Closed 2ndGAB closed 8 years ago
Note: The error you are seeing is usually associated with an application that has been forced stopped in which case it cannot respond to incoming notifications. However if you are getting this error without the application being forced stopped then it will require some further investigation.
@jtushar53 your input here would also be appreciated, if this is indeed a duplicate of your background issue.
I have same problem... cannot able to handle notification when app is in background. It is handled by system tray.
Hello,
The message I talk about W/GCM-DMM...
is displayed in the log window just after I send a message to the device and everytime I send it to the device.
For example, I just sent it 3 times to the device for demo and I get the following display in logcat:
07-19 08:21:14.691 3068-3068/? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.google.firebase.quickstart.fcm (has extras) }
07-19 08:21:16.480 3068-3068/? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.google.firebase.quickstart.fcm (has extras) }
07-19 08:21:18.934 3068-3068/? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.google.firebase.quickstart.fcm (has extras) }
So I don't think my application has been stopped three times successively but I think that the system cannot call the application for any reason. Does what was called receiver
in GCM and now handled by the library still works anymore as expected?
I also see that when I tap on the recent apps button, the following message is displayed:
07-19 08:48:57.656 32267-32267/com.my.example D/FirebaseApp: Notifying background state change listeners.
But to be honest, I wonder if the problem only comes from FCM because if I start from my own project which worked few weeks ago and rebuild it, I cannot get it working anymore. But I had many updates suggested by Android through the studio. I currently use Studio 2.1.2, build tools 24.0.0
What really disturb me is the blur about this functionality everywhere including in the doc as if the ability to send data messages to a background/stopped (as you want) application was just discovered last night! But almost all applications such as client mail, news, etc..., work like that no??
Hii,
for me tested other devices inlcuding Moto G edition and One Plus 2 it is working and on Mi5 it is not working, was getting same error.
Updated: @kroikie application was not force close just swiped away from recents tray, also if i just press home button(app is minimise) it i am able to see notification in notification tray.
After googling a bit looks like lots of mi5 users are getting this issue from http://en.miui.com/thread-268224-1-1.html and http://en.miui.com/thread-272403-1-1.html , tried that but no luck.
This error is seen when your application has been forced stopped.
Using the command:
adb shell dumpsys package
If you get the result: User 0: installed=true hidden=false stopped=false notLaunched=false enabled=0 Then since stopped is false your app should get the notification. If however your result is: User 0: installed=true hidden=false stopped=true notLaunched=false enabled=0 Then since stopped is true your app cannot be started to handle the incoming message.
Could you check if when you remove the app from the recents list or just pause the app by hitting the home button, what the status of your app is? stopped=true or stopped=false?
The expectation is that when you swipe an app from recents the stopped value should still be false, but some launchers are not adhering to this, so if you can confirm the status of your app we can narrow down the issue.
Hello @kroikie Sorry for the late reply. The command adb shell dumpsys package | grep stopped
tells me the following message, the application running or not:
Can't find service: com.google.firebase.quickstart.fcm
For information, when I put your application in background, I get the following log:
--------- beginning of system
07-22 12:28:00.591 671-745/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from uid 10024 on display 0
07-22 12:28:00.630 671-3321/? I/ActivityManager: Killing 17165:com.google.firebase.quickstart.fcm/u0a293 (adj 9): remove task
07-22 12:28:00.656 671-31254/? D/GraphicsStats: Buffer count: 4
07-22 12:28:00.656 671-745/? I/WindowState: WIN DEATH: Window{2349355 u0 com.google.firebase.quickstart.fcm/com.google.firebase.quickstart.fcm.MainActivity}
07-22 12:28:01.011 745-745/? W/Binder_2: type=1400 audit(0.0:13166): avc: denied { ioctl } for path="socket:[2808607]" dev="sockfs" ino=2808607 ioctlcmd=7704 scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=unix_stream_socket permissive=0
07-22 12:28:01.011 745-745/? W/Binder_2: type=1400 audit(0.0:13167): avc: denied { ioctl } for path="socket:[2808607]" dev="sockfs" ino=2808607 ioctlcmd=7704 scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=unix_stream_socket permissive=0
07-22 12:28:01.579 3723-3958/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
07-22 12:28:01.579 3723-3958/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
07-22 12:28:01.660 17340-17340/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
07-22 12:28:01.669 17340-17340/? D/AndroidRuntime: CheckJNI is OFF
07-22 12:28:01.707 27646-27659/? D/==FindMyPhone==: 1469183281707
07-22 12:28:01.752 17340-17340/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
07-22 12:28:01.819 17340-17340/? I/Radio-JNI: register_android_hardware_Radio DONE
07-22 12:28:01.857 17340-17340/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
07-22 12:28:01.860 671-745/? I/ActivityManager: Force stopping com.google.firebase.quickstart.fcm appid=10293 user=0: from pid 17340
07-22 12:28:01.865 17340-17340/? D/AndroidRuntime: Shutting down VM
07-22 12:28:01.867 201-201/? D/NuPlayerDriver: stop(0xb3d2b6c0)
07-22 12:28:01.867 201-201/? D/NuPlayerDriver: notifyListener_l(0xb3d2b6c0), (8, 0, 0)
07-22 12:28:01.869 3032-2494/? W/MessageQueue: Handler (android.media.MediaPlayer$EventHandler) {2d81fea} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.media.MediaPlayer$EventHandler) {2d81fea} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:543)
at android.os.Handler.enqueueMessage(Handler.java:631)
at android.os.Handler.sendMessageAtTime(Handler.java:600)
at android.os.Handler.sendMessageDelayed(Handler.java:570)
at android.os.Handler.sendMessage(Handler.java:507)
at android.media.MediaPlayer.postEventFromNative(MediaPlayer.java:2988)
07-22 12:28:01.869 201-698/? D/NuPlayerDriver: reset(0xb3d2b6c0)
07-22 12:28:01.876 201-17250/? W/AMessage: failed to post message as target looper for handler 0 is gone.
07-22 12:28:01.879 201-17250/? D/NuPlayerDriver: notifyResetComplete(0xb3d2b6c0)
How can I help you more? Didi you verified if you are able to send message to your quickstart-android messaging app from your side?
@2ndGAB Thanks for the logcat info, looks like the fcm sample is being stopped when it is being sent to the background.
07-22 12:28:01.860 671-745/? I/ActivityManager: Force stopping com.google.firebase.quickstart.fcm appid=10293 user=0: from pid 17340
I'm not sure why Activity Manager is killing the sample app when you put it in a background state. This is not expected behaviour, what device are you trying this one? Some devices have restrictions on what applications can be run in the background, I'm wondering if your device is stopping some apps when swiped from recents and not others.
Hi @kroikie I tried on a Nexus 7 6.0.1 So I tried on a GT-9295 5.0.1 and I get the same result:
07-23 20:16:34.620 803-1408/? I/ActivityManager: Force stopping com.google.firebase.quickstart.fcm appid=10317 user=0: from pid 7231
07-23 20:16:34.620 803-1408/? I/ActivityManager: Force stopping service ServiceRecord{3cada6f8 u0 com.google.firebase.quickstart.fcm/.MyFirebaseMessagingService}
And these are the same devices I used for months to test my apps. If the Nexus has been regularly updated, this is not the question of the GT9295/5.0.1 so no reason to doubt on them.
that's really incredible.
I tried to rebuild an old working project of mine with sdk 23, GCM 8.4.0, java 1.7, so the environment I got working project with and I cannot get a working application anymore!
The only differnece I see now is the version of Android-studio/gradle.
Could please tell me if you build working projects with the last development environment updates???
THAT'S COMPLETELY INCREDIBLE
I've reisntalled Android Studio 1.5 bundle 141.2422023, sdk 23.0.3, java jdk1.7.0_79 and rebuilt your application.
The result is amazing. I don't have the Force Stopping message anymore when I put the application in background.
07-24 12:00:10.409 671-3321/? I/ActivityManager: Killing 11067:com.google.firebase.quickstart.fcm/u0a297 (adj 9): remove task
07-24 12:00:10.425 671-31254/? D/GraphicsStats: Buffer count: 4
07-24 12:00:10.425 671-31254/? I/WindowState: WIN DEATH: Window{996cbf7 u0 com.google.firebase.quickstart.fcm/com.google.firebase.quickstart.fcm.MainActivity}
And, it correctly receives and processes the data message in background
messaging app has been successfully rebuilt under Studio 1.5.2 with sdk 24, buildtools 24.0.0, and java 1.8.0_92
Please Please Pleasssssssseeeeeeeee tell me what's wrong !!!!!!
@2ndGAB thanks for the information, we do test our samples against the latest developer environments. I don't think that you are doing anything wrong here, it is very unusual what you are experiencing. I'm looking into it and will reply here with more. If you can, in the meantime, use AS 1.5.2.
Hi @2ndGAB there should be no change affecting the build between AS 1.5 and 2.1, could you confirm that you are not changing anything in the messaging quickstart? As in git status does not indicate any changes?
Hi @kroikie
OOOOOOOHHHHHHHHHHHHH YESSSSSSS!!!
Please have a look at my complete tests here
;-/
Regards,
Hi @2ndGAB couple things that you did not mention that might help:
After updating to 2.1.2:
did you try building the project from the command line? From the project directory:
.\gradlew.bat :app:assembleDebug
Hi @kroikie
I deactivated instant run Yes of course I cleaned/rebuilt many times/ But I didn't try to built it from command line. I'll test it.
@2ndGAB hey did you fixed using AS 1.52 ?
CAN NOT receive a message when app is in background . D/FirebaseApp: Notifying background state change listeners. W/FirebaseMessaging: Unable to log event, missing measurement library
@yucheng82 First check if your device receives the message. Have a look at the logcat view and see if you receive such kind of messages:
mm-dd hh:ii:ss.nnn 1461-1461/? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.your.package (has extras) }
If no, maybe you don't use the right token.
If yes, please tell me what Android Studio version do you use.
@2ndGAB
My Android Studio is 2.1.2
message lib version:
com.google.firebase:firebase-messaging:9.2.1
My App token is ok .
When App is in foreground, Can receive FCM message:
D/MyFirebaseMsgService: From: 568540028909
D/MyFirebaseMsgService: Message Notification Body: Test Message
when in background CAN NOT receive Message and log is:
W/FirebaseMessaging: Unable to log event, missing measurement library
@2ndGAB I find when APP is in background the FCM message is show by notification , not send message to my APP. and when message is stop, noting is received. How can i receive a message when app is in background and app is not running. Thanks!
@yucheng82 so to see if you are facing the same problem as me, I can advise you to install Android Studio 1.5 from here.
Install it in a different folder so you keep 2.1.2 version. You can specify a different sdk folder as well but in fact, the problem seems not coming from it.
Then you open your project in AS 1.5, without changing anything except if you swithed to Java 1.8. You will have to come back to 1.7.
Build your project and verify if now you receive data message in background...
Just a precision, I as working with data message only, not notification + data messages. It seems it's what you use.
SO I tested this case, to see. If I'm right, the message should be :
{
"to" : "ff7dwHxWZeE:APA91bFbzYFqFKUwYW...c_1TfunYKKYXcjiX5a",
"notification": {
"title": "just a test",
"msg": "Just to verify"
}
"data": {
"id": 19,
"title": "Title test",
"msg": "Text of the test",
"code": 2,
"infosUrl": "http://www.example.com",
"longitude": 5.5,
"latitude": 44.5,
"eventLocation": "nowhere",
"startDate": "31/07/2016 20:00",
"endDate": "31/07/2016 22:00",
"publishEndDate": "31/07/2016 20:00"
}
"content_available": true
}
In that case, when the application is in foreground, the application receives the data and when the application is in background, the system receives the notification.
So, to be sure that your application receives a data message in foreground AND in background, you need to send a DATA ONLY message like below:
{
"to" : "ff7dwHxWZeE:APA91bFbzYFqFKUwYW...c_1TfunYKKYXcjiX5a",
"data": {
"id": 19,
"title": "Title test",
"msg": "Text of the test",
"code": 2,
"infosUrl": "http://www.example.com",
"longitude": 5.5,
"latitude": 44.5,
"eventLocation": "nowhere",
"startDate": "31/07/2016 20:00",
"endDate": "31/07/2016 22:00",
"publishEndDate": "31/07/2016 20:00"
}
"content_available": true
}
AFAIK, firebase console is not able to send such message, so you need to use the API mode with Google Advanced REST Client
@yucheng82 are you seeing this behaviour while running this sample? The warning you are mentioning about the missing measurement library should not prevent your app from receiving the message, that is just an indication that the automatic analytics provided by FCM will not work.
@2ndGAB I'm not convinced that the issue you are facing is due to an Android Studio version change, nor am I convinced that it is the issue being faced by @yucheng82. All Android Studio is doing is executing kicking off the build eg: ./gradlew :app:assembleDebug
so there should not be anything in Android Studio itself that would affect the built APK of your application. I understand that it looks like Android Studio to you, and it may be, but I'd suggest trying building from the command line first and seeing if the issue persists.
@kroikie maybe but did you have a look at all tests I made here ?
So I tried to build from the Android Studio 1.5 terminal and here is what has been done:
C:\Users\me\Documents\GitHub\MyApp>.\gradlew.bat :app:assembleDebug
Downloading https://services.gradle.org/distributions/gradle-2.10-all.zip
............................
Unzipping C:\Users\me.gradle\wrapper\dists\gradle-2.10-all\5b6kqrscumh9p4evkkemdk57ad\gradle-2.10-all.zip to C:\Users\me.gradle\wrapper\dists\gradle-2.10-all\5b6kqrscumh9p4evkkemdk57ad
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom
Download https://jcenter.bintray.com/org/ow2/ow2/1.3/ow2-1.3.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-parent/5.2.1/proguard-parent-5.2.1.pom
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.4.201502262128/org.jacoco.core-0.7.4.201502262128.pom
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.build/0.7.4.201502262128/org.jacoco.build-0.7.4.201502262128.pom
Download https://jcenter.bintray.com/org/antlr/antlr/3.5.2/antlr-3.5.2.pom
Download https://jcenter.bintray.com/org/antlr/antlr-master/3.5.2/antlr-master-3.5.2.pom
Download https://jcenter.bintray.com/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Download https://jcenter.bintray.com/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom
Download https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.pom
Download https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.pom
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.pom
Download https://jcenter.bintray.com/com/google/guava/guava/17.0/guava-17.0.pom
Download https://jcenter.bintray.com/com/google/guava/guava-parent/17.0/guava-parent-17.0.pom
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4/4.5/antlr4-4.5.pom
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4-master/4.5/antlr4-master-4.5.pom
Download https://jcenter.bintray.com/commons-io/commons-io/2.4/commons-io-2.4.pom
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/25/commons-parent-25.pom
Download https://jcenter.bintray.com/org/apache/apache/9/apache-9.pom
Download https://jcenter.bintray.com/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.0.1/asm-parent-5.0.1.pom
Download https://jcenter.bintray.com/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.pom
Download https://jcenter.bintray.com/org/antlr/ST4/4.0.8/ST4-4.0.8.pom
Download https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.1.1/httpcomponents-client-4.1.1.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.1/httpcomponents-client-4.1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.pom
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4-runtime/4.5/antlr4-runtime-4.5.pom
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4-annotations/4.5/antlr4-annotations-4.5.pom
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.pom
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-core/4.1/httpcomponents-core-4.1.pom
Download https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/5/commons-parent-5.pom
Download https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom
Download https://jcenter.bintray.com/commons-codec/commons-codec/1.4/commons-codec-1.4.pom
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/11/commons-parent-11.pom
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.pom
Download https://jcenter.bintray.com/org/abego/treelayout/org.abego.treelayout.core/1.0.1/org.abego.treelayout.core-1.0.1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.jar
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.4.201502262128/org.jacoco.core-0.7.4.201502262128.jar
Download https://jcenter.bintray.com/org/antlr/antlr/3.5.2/antlr-3.5.2.jar
Download https://jcenter.bintray.com/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar
Download https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar
Download https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.jar
Download https://jcenter.bintray.com/com/google/guava/guava/17.0/guava-17.0.jar
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4/4.5/antlr4-4.5.jar
Download https://jcenter.bintray.com/commons-io/commons-io/2.4/commons-io-2.4.jar
Download https://jcenter.bintray.com/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.jar
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.jar
Download https://jcenter.bintray.com/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.jar
Download https://jcenter.bintray.com/org/antlr/ST4/4.0.8/ST4-4.0.8.jar
Download https://jcenter.bintray.com/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
Download https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4-runtime/4.5/antlr4-runtime-4.5.jar
Download https://jcenter.bintray.com/com/tunnelvisionlabs/antlr4-annotations/4.5/antlr4-annotations-4.5.jar
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.jar
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar
Download https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
Download https://jcenter.bintray.com/commons-codec/commons-codec/1.4/commons-codec-1.4.jar
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar
Download https://jcenter.bintray.com/org/abego/treelayout/org.abego.treelayout.core/1.0.1/org.abego.treelayout.core-1.0.1.jar
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2411Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72411Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportCustomtabs2340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42411Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2411Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk4140Library UP-TO-DATE
:app:prepareComGithubMKergallOsmbonuspackV581Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing921Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase921Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement921Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation921Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks921Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics921Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl921Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon921Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore921Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid921Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging921Library UP-TO-DATE
:app:prepareMeDm7BarcodescannerCore184Library UP-TO-DATE
:app:prepareMeDm7BarcodescannerZxing184Library UP-TO-DATE
:app:prepareOrgOsmdroidOsmdroidAndroid52Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: C:\Users\me\Documents\GitHub\MyApp\app\google-services.json
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\me\Documents\GitHub\MyApp\app\src\main\java\com\my\package\Fragment_downloadMaps.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:prePackageMarkerForDebug
:app:transformClassesWithDexForDebug
Result compacted from 8326,4KiB to 6356,0KiB to save 1970,4KiB
Merged dex #1 (15 defs/26,9KiB)
Merged dex #2 (36 defs/34,3KiB)
Merged dex #3 (5 defs/15,3KiB)
Merged dex #4 (355 defs/574,2KiB)
Merged dex #5 (13 defs/22,9KiB)
Merged dex #6 (21 defs/21,2KiB)
Merged dex #7 (819 defs/997,1KiB)
Merged dex #8 (17 defs/48,5KiB)
Merged dex #9 (558 defs/621,0KiB)
Merged dex #10 (80 defs/147,1KiB)
Merged dex #11 (81 defs/68,0KiB)
Merged dex #12 (265 defs/237,9KiB)
Merged dex #13 (530 defs/522,3KiB)
Merged dex #14 (109 defs/90,5KiB)
Merged dex #15 (29 defs/20,5KiB)
Merged dex #16 (3 defs/3,6KiB)
Merged dex #17 (115 defs/202,5KiB)
Merged dex #18 (22 defs/23,4KiB)
Merged dex #19 (15 defs/33,5KiB)
Merged dex #20 (10 defs/22,6KiB)
Merged dex #21 (110 defs/178,4KiB)
Merged dex #22 (217 defs/459,2KiB)
Merged dex #23 (177 defs/288,0KiB)
Merged dex #24 (264 defs/481,2KiB)
Merged dex #25 (289 defs/589,8KiB)
Merged dex #26 (165 defs/171,2KiB)
Merged dex #27 (363 defs/280,8KiB)
Merged dex #28 (12 defs/19,4KiB)
Merged dex #29 (4 defs/7,1KiB)
Merged dex #30 (175 defs/299,9KiB)
Merged dex #31 (34 defs/67,9KiB)
Merged dex #32 (201 defs/282,5KiB)
Merged dex #33 (46 defs/7,4KiB)
Result is 5155 defs/6356,0KiB. Took 0,7s
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:assembleDebug
BUILD SUCCESSFUL
And I installed the resulting package
adb -s xxxxxxx install .\app\build\outputs\apk\app-debug.apk
And the application receives data message in background.
And I installed the resulting package
adb -s xxxxxxx install .\app\build\outputs\apk\app-debug.apk
And the application receives data message in background.
And the application DOES NOT receive data message in background.
Anyway, what I see from my side is the development environment installed by Android Studio and everything installed to build an application from the source code. And the tests I made prove that something installed beside sdk, build-tools and Java modify the build.
How can we conclude something else?
There is something which would really interest me, this is to know if for you, sending a data message it to your messaging app really works when built from the latest dev env. And if yes, why that point is not clearly explained in the doc?
@2ndGAB could you try uninstalling both versions of Android Studio and building from the command line like you have done here and see if the issue persists?
@kroikie but as you can see, that doesn't depend on sdk and build tools, so I'll be in one of the 2 first cases i.e. building from the command line and building from command line seems to work without problem.
Again, the problem comes if I launch the build from Android Studio 2.
So what do you expect to see more?
@2ndGAB Sorry miss read your post, could you try the 2.2 preview, if there is an issue in 2.1 it may have already been fixed.
ok I'll try
So, I've installed AS 2.2 Preview 7, I installed evertyhing, I didn't import the settings from AS 2.1
I rebuilt my project, same problem!
I've upgrade my project to 9.4.0, same problem!
@mindfreak269 do you talk here about notification message or data message?
@kroikie @anujjpandey11 Hi I faced into the same issue. My app is built in Android 2.1.2. My app receive the FCM notification with Android service extending the FirebaseMessagingService Although it's not working when my app is clear from the background
There are some questions I am curious about
1.why my app is using 'service' but not 'receiver' in Manifeset.xml 2.is there any problem with FCM ? Since it worked few days ago.
P.S. I added key "notification" and "data" in my sending message .PHP
@MiniJay if you send notification+data message, your application is not supposed to receive it when it's in background. Only the system tray receives it. But in that case, when you tap the notification, your application is supposed to be launched and receives the data through the intent.
From Firebase messaging
Messages with both notification and data payloads App behavior when receiving messages that include both notification and data payloads depends on whether the app is in the background or the foreground—essentially, whether or not it is active at the time of receipt. When in the background, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification. When in the foreground, your app receives a message object with both payloads available.
If you want your application receives data while in background, you need to send a data only message.
hi @2ndGAB,
I got data from from Intent throw: intent.getStringExtra("ll")
. Is it proper way to get data from received intent?
Thanks!
@lenguyenthanh I would prefer to let @kroikie to answer that point as I didn't explore this feature again from my side.
@MiniJay
com.google.firebase.iid.FirebaseInstanceIdReceiver
this serves both the FirebaseMessagingService and the FirebaseInstanceIDService.@lenguyenthanh you are retrieving the data correctly, however be sure to check that the intent extra exists since sometimes the intent may be fired without those extras.
@mindfreak269 what you are seeing is working as intended, if the app is killed by the user the expectation is that it should not be restarted without their explicit indication (by launching the app) that they want the app to run. Thus if your app is killed it should not receive FCM messages. From docs:
Note that the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents. It does this to prevent broadcasts from background services from inadvertently or unnecessarily launching components of stoppped applications.
@2ndGAB I will take your issue back to the Android Studio team. What platform are you running AS on?
This issue seems not to be related to the sample so I'm closing it, however feel free to create new issues.
Thanks @kroikie for answering my question :)
@kroikie on Windows 10 Professional Edition. To resume, I currently use AS 1.5 without any problem, I can build/start your projet and mine from the IDE (I mean from the debug button) and I onMessageReceive() is fired for data message in foreground and background.
From AS 2.1 and 2.2, I can get a working project if I build/install the application from the terminal as you suggested to me. BUT if I build/install the application from the IDE, data message don't fire onMessageReceive() whe the app is in background.
All details of my tests are here
Thanks @2ndGAB to be clear are you saying that any project built with AS 2.1 or later causes the app to be stopped once it is removed from recents menu?
Facing the same issue. Refer https://code.google.com/p/android/issues/detail?id=219084
@kroikie At least I can say that I have the exact same behavior on your project and mine.
Is this issue fixed? Updated today to FCM and fasted the remaining time to debug this. If I see it right you can't receive notification messages with data in background anymore. This is more or less intended. Please confirm. If so do we need to stay with GCM? Is an update / fix planned? As this breaks the behaviour. It seems their is no way to get rid of the default notification message and so also no way to add custom behavior with button nor custom look an feel in the notification. Even i18n needs to be done one the server now too.
The issue here is a result of some devices prematurely closing applications when they are swiped from the recents view. We are working with device makers to ensure that they are correctly handling dismissal from the recents view. This is not an FCM specific issue, GCM will be affected in the same way.
If your app is in the background you should receive data messages in the onMessageReceived callback and notification messages would result in a displayed notification. If you want to highly customize the notification that is shown then you should use data messages and handle the notification creation on the device side.
@sterlp I would like to trust @kroikie but from my side, I'm still thinking that devices are not -only- in cause here. Since I choosed to keep using Android Studio 1.5, I didn't notice any problem anymore but of course, I cannot make tests with enough different devices. Maybe I could check if I can reach all installed application, at least on and Android because iOS is again a different problem. I haven't so much time at the moment but I'll try to think about it. I wonder if it's possible...
It seems that my hypothesis is not really considered serioulsy, but if you have time, just try to build your app with AS 1.5 and test it on the devices which cause problem, to see....
https://code.google.com/p/android/issues/detail?id=
Maybe also try to build your app from command line because AFAIR, I made this test on @kroikie's advice and it seems working, but not really comfortable in the IDE.
I can confirm the crash of the App with click_action set in the Notification. I added the intents to the activities. On click nothing happens. I can see in the IDE a background crash of the app.
Build tools 24.0.0 FCM 9.6.1 Android Studio 2.2.1 Android 6 and Android 5.1
using a data message only works as expected -- basically like with GCM, of course the notification is missing.
// disclamer as new bug Furthermore Color & ICON doesn't work together. My color is white and the icon is displayed okay on top left, if I open the notification center it is just white, message and title works at least. default Sound isn't played.
Just to add that for me the problem is solved in Android Studio 2.2.2 145.3360264.
FCM data messages are well received in onMessageReceive() when the app is in background and custom notifications are successfully generated !!! ;-)
With Android Studio >= 2.2 there is an issue displaying notification when app was killed (by swiping away from recent apps). But it's the case just on some devices, presumably on ones that initiate force stop when you swipe the app from recents. AFAIK there is no way to fix this except changing the manufacturing process, so hopefully OEMs will take this issue into consideration.
In android studio 1.5 chances of app getting force killed are lesser than android studio 2.0.
On Nov 6, 2016 9:35 PM, "vitnuk" notifications@github.com wrote:
With Android Studio >= 2.2 there is an issue displaying notification when app was killed (by swiping away from recent apps). But it's the case just on some devices, presumably on ones that initiate force stop when you swipe the app from recents. AFAIK there is no way to fix this except changing the manufacturing process, so hopefully OEMs will take this issue into consideration.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/firebase/quickstart-android/issues/89#issuecomment-258690540, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiHzpazjVOkUWN9Y4b5TaaJaFGEfjc9ks5q7frEgaJpZM4JOtXI .
@codenpk This what I noticed. Now I recently tested it with AS 2.2.2 and I don't have this issue anymore. Note that I don't use FCM notification or notifications with data-messages but data-messages only.
@2ndGAB I'm using AS 2.2 and data-messages only, it does not work when the app was killed on Lenovo A6010 Pro, but works great on emulators and couple of other devices.
@codenpk I've heard talking about such problems on specific devices. Difficult to guess if that could come from the manufacturer or a possible issue in firebase....
Step 1: Are you in the right place?
Step 2: Describe your environment
But I cannot get it working on Nexus 7 LTE 6.0.1 or Samsung GT-9295 5.0.1 as well.
Step 3: Describe the problem:
I send the following message with Advanced REST Client, the message is sent successfully, but is only received in foreground and not when the application is in background.
Steps to reproduce:
Send it a data message when the application is in background
Observed Results:
Expected Results:
Relevant Code:
My FirebaseMessagingService is: