Closed 2ndGAB closed 8 years ago
I can confirm the same issue, using this configuration: devices: Nexus 5 AND Google Pixel, Firebase dependencies: compile 'com.google.firebase:firebase-core:10.0.1' compile 'com.google.firebase:firebase-messaging:10.0.1' IDE: Android studio 2.2, stable channel
Log: Server sends data-only message, but if the app is killed, I get: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.whatever (has extras) }
Judging by @2ndGAB I should try newer AS release ?
Hmmm, with this Firebase, each day you learn something extraordinary :)
Updating to latest Android Studio(2.3 beta 1) and accompanying gradle version (as well as buildToolsVersion '25.0.0'), it seem to work as intended, that is, seem to work even if app is in "swipe to kill" or in background. Will keep tracking this, as a number of customers using our application filed this issue. I'll push a new version to the store and will inform you if this hack really works for a greater device pool, so we all can close this one and get some sleep.
Hello @miroslavign, Glad to here that, I arrived to the same conclusion where this feature strangely stopped to work with the first 2.X AS versions.
New issue, will test it more to determine, but we had a complaint from two customers using latest N version (Nexus 6P and Pixel). We will investigate more if this is actually version specific now.
@miroslavign, @kroikie in fact I recently discovered that sometimes, at least because I'm not absolutely sure it's not something new again, data messages are not received when we install a debug apk!!
@2ndGAB tnx for sharing that. I'm gonna concentrate on testing release builds only, but then, I'm not sure if we're going to be able to see the message: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.whatever (has extras) }
@kroikie a question related to making a service go to a new process using android:process=":remote"
After inserting that line, I get a crash on my service (and it is not running after that): java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.whatever:remote. Make sure to call FirebaseApp.initializeApp(Context) first.
Now, before this, I did not use anything in my background service related to FCM, so, why and (more importantly) how could I do this in my service ? Initialize what ? Adding this my service, does not work out of the box: @Override public void onCreate() { FirebaseApp.initializeApp(this);
Any ideas, because, putting my service (which should be always running no matter if app is killed), may resolve most of the problems our app has, related to FCM missing documentation...
Anyone is having some news about this issue?
I find what seems the same problem.
Android 4.4, firebase:firebase-messaging:10.0.1, AS:2.3 beta 3 We made a little App with an activity and a couple of services. First service is the FCM receptor, second One is a service that we will keep working in foreground with his own notification.
When the activity is running, if the FCM device gets a message, the onMessageReceived is launched as intended. But if we swipe out the Activity, and the foreground service is still working, when a message is received, the service simply dissapears with a Force stopping message. Same behavior in android 5 and 5.1, in android 6 and 7 seems to work as intended.
@alcastelo Just to verify something, did you have a look at at some articles upper in this thread related to the Android Studio version if you use it?
Same issue here:
`05-31 15:33:34.493: W/GCM(3435): Mismatched messenger
05-31 15:34:52.593: W/GCM-DMM(3435): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.whatever (has extras) }
05-31 15:34:52.603: W/GCM-DMM(3435): Unregister application com.whatever for user 0`
I'm using AS 2.3.2, JRE: 1.8.0_112., Firebase 10.2.4, device is Samsung Galaxy J5 (SM-J500M) and Android version is 6.0.1
Same issue here https://github.com/phonegap/phonegap-plugin-push/issues/707#issuecomment-309211376:
06-17 13:51:52.028 4952 7647 I SendBroadcastPermission: action:com.google.android.c2dm.intent.RECEIVE, mPermissionType:0 06-17 13:51:52.042 4952 4952 W GCM-DMM : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=info.larinconadasisepuede.lrssp (has extras) }
I'm using AS 2.3.3 recently updated, device Huawei P8, Android 6.0, EMUI 4.0.1
@2ndGAB I am using AS 2.3.3 compile SDK version -25 Support lib version - 25.3.1 Google Play services version -11.0.4
When app is in foreground I get notification with data, but when an app is in the background or killed notification not received with data,
I get the following logs
W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=packgeName (has extras) }
it works perfectly with notification but I can't customize. Tested on One plus 5 .OS 7.1.1
finally here is my answer.https://stackoverflow.com/a/45810771/1993001
Have also seen this on a beta Crashlytics build, and I'm positive I had not manually pressed FORCE STOP in app settings. I'm able to repro by going into app settings and force closing the app.
Swiping to close the app does not cause this issue (at least not in my tests).
08-11 11:19:30.900 ? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.my.package (has extras) }
@loeschg what phone model do you use?
@Florin-Birgu Pixel (7.1.2)
I wish I could provide more info, but I'm not able to reproduce the scenario. I did have it happen periodically (~1x a week for a couple months). I haven't seen it for a few weeks now.
Random bits of info that may help correlate a root cause:
Edit: Also realizing this may not be the proper ticket for this discussion. Arrived here from Google-ing. Let me know if I should open a separate ticket somewhere.
same thing happening with me ,bothering me from week now this message came when my app is swiped from tray
GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.lifepage.jfh (has extras) }
and so far reading the suggestions above the only solution i got is install android studio 1.5 is this correct or there are other solutions for this problem???
device - oneplus 3t android studio - 2.3.3 build version - 25.0.3
i tried fcm and gcm both.
log with gcm --
08-14 10:20:58.677 8904-8923/com.lifepage.jfh D/FA: Logging event (FE): session_start(_s), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=TutorialActivity, firebase_screen_id(_si)=-4275405240345914240}] 08-14 10:20:58.699 8904-8923/com.lifepage.jfh V/FA: Using measurement service 08-14 10:20:58.699 8904-8923/com.lifepage.jfh V/FA: Connecting to remote service 08-14 10:20:58.712 8904-8923/com.lifepage.jfh D/FA: Connected to remote service 08-14 10:20:58.712 8904-8923/com.lifepage.jfh V/FA: Processing queued up service tasks: 1 08-14 10:20:58.774 19291-9018/? V/FA-SVC: Event recorded: Event{appId='com.lifepage.jfh', name='session_start(_s)', params=Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=TutorialActivity, firebase_screen_id(_si)=-4275405240345914240}]} 08-14 10:21:03.747 8904-8923/com.lifepage.jfh V/FA: Inactivity, disconnecting from the service 08-14 10:22:32.461 8904-10577/com.lifepage.jfh D/GcmNotificationListener: From: 213539449012 08-14 10:22:32.461 8904-10577/com.lifepage.jfh D/GcmNotificationListener: Message: 20170518-0001 08-14 10:22:32.462 8904-10577/com.lifepage.jfh D/GcmNotificationListener: data payload accepted 08-14 10:22:48.557 3486-3486/? D/SystemServicesProxy: getRecentTasks: com.lifepage.jfh 08-14 10:22:48.602 2779-2856/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{c7c64b5 u0 com.lifepage.jfh/com.lifepage.jfh.TutorialActivity} token=android.os.Binder@98727f9 which=1 08-14 10:22:48.607 8904-10802/com.lifepage.jfh D/AppTracker: App Event: stop 08-14 10:22:48.610 8904-10803/com.lifepage.jfh V/FA: Recording user engagement, ms: 119948 08-14 10:22:48.611 8904-10803/com.lifepage.jfh V/FA: Using measurement service 08-14 10:22:48.611 8904-10803/com.lifepage.jfh V/FA: Connecting to remote service 08-14 10:22:48.615 8904-10803/com.lifepage.jfh V/FA: Activity paused, time: 1208442468 08-14 10:22:48.618 8904-10803/com.lifepage.jfh D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=119948, firebase_screen_class(_sc)=TutorialActivity, firebase_screen_id(_si)=-4275405240345914240}] 08-14 10:22:48.641 8904-10803/com.lifepage.jfh V/FA: Using measurement service 08-14 10:22:48.641 8904-10803/com.lifepage.jfh V/FA: Connection attempt already in progress 08-14 10:22:48.641 8904-10803/com.lifepage.jfh D/FA: Connected to remote service 08-14 10:22:48.641 8904-10803/com.lifepage.jfh V/FA: Processing queued up service tasks: 2 08-14 10:22:48.708 19291-10804/? V/FA-SVC: Event recorded: Event{appId='com.lifepage.jfh', name='user_engagement(_e)', params=Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=119948, firebase_screen_class(_sc)=TutorialActivity, firebase_screen_id(_si)=-4275405240345914240}]} 08-14 10:22:48.741 3486-3486/? D/SystemServicesProxy: getRecentTasks: com.lifepage.jfh 08-14 10:22:49.664 2779-4232/? I/ActivityManager: Killing 8904:com.lifepage.jfh/u0a212 (adj 900): remove task 08-14 10:22:49.665 2779-4232/? I/ActivityManager: Killing 8956:com.lifepage.jfh:download_queue/u0a212 (adj 904): remove task 08-14 10:22:49.705 2779-3717/? I/WindowManager: WIN DEATH: Window{c7c64b5 u0 com.lifepage.jfh/com.lifepage.jfh.TutorialActivity} 08-14 10:23:04.678 24779-24779/? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.lifepage.jfh (has extras) }
Same issue here: 09-20 22:00:29.320 2485-2485/com.google.android.gms.persistent W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=(my package) (has extras) }
I was hoping updating to the lastest libs would fix this, but it does not. AS 2.3.3 om.google.gms:google-services:3.1.1 com.google.firebase:firebase-messaging:11.0.4
Facing similar issue : 01-31 12:54:57.417: W/GCM-DMM(2638): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=np.ngopal.net.cbts.marcopolo (has extras) }
I am using Android Oreo in Oneplus 3 device. I closed the app by swipping away from task list. But if i have app running behind it will show the notification.
@privatejava This might be helpful for you https://stackoverflow.com/a/45810771/1993001
Thanks @rahuldevanavar91 It worked after i disable the battery optimization even after i cleared from task list.
But I am amazed how are other apps being able to send notification even if i cleared them via task list when i literally have battery optimization enabled.
@privatejava ... if battery optimization is enabled other applications also not receive the notification I cheked this, only WhatsApp notification you will get
@rahuldevanavar91 any idea how WhatsApp is doing it?
@spddheeraj May be they will try to create a background services app once they gets killed manually . So they would always get notification.
Also getting this issue, is there any resolutions at this time?
@privatejava can you help me how to create service running on FirebaseMessagingService?
Why does not SDK call onMessageReceived in background? I can not find a reasonable reason.
I found a related topic stating that we can send only notification messages through Firebase Console. If we want a datapayload message we can send that using Postman.
{
"to" : "token of client",
"collapse_key" : "type_a",
"data" : {
"body" : "Test",
"title": "Test",
"message" : "Test"
}
}
Please note that we have not sent "notification" here as we only want the payload to be given. Reference: https://stackoverflow.com/questions/37454501/firebase-fcm-force-ontokenrefresh-to-be-called
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: