Closed tss101 closed 6 years ago
this seems to be more of a firebase ticket
com.google.android.c2dm.intent.RECEIVE
is not an intent this package listens to or send out.
Thanks, though I'm not sure why notifications in our app are getting killed, since we only use the react-native-fcm package. We're pretty certain this is the event that's responsible for stopping the notifications, but we're not sure why it might be related to com.google.android.c2dm.intent.RECEIVE.
Many thanks @evollu
I'd taken a look at the first one before but I don't think applies here. I've received a few more reports, and some of them didn't receive the:
05-07 17:18:01.849 27551 27551 W GCM : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=to.synced.synced (has extras) }
message. Also this is pretty much on stock Android, so swiping the app away shouldn't result in force kill like on the OnePlus 3T. However it might be related to Android 8's new battery saving features.
The second link is interesting:
notification payload can be send using data tag or notification tag. using data tag it will trigger the FirebaseMessagingService onMessageReceived method. it will not work on some devices, when an app is in the background.
We're still trying to figure out when exactly notifications stop working, but it is quite possible they stop delivering while the app is in the background, and don't restart until the app is swiped away and restarted.
It's quite hard to catch however as it happens infrequently (why we think it's related to the battery saving Android 8 features). Currently we're sending notifications every five minutes to some test devices, and once they're stop appearing on the device they don't reappear until the app is reopened.
I think it might have to do battery saving as well. Can you try native firebase SDK example for Android and see if you can reproduce the issue?
Sure, I've installed it, and will try sending regular notifications to see if they stop at the same time
Actually maybe the best strategy is to send a notification to Firebase after my app stops receiving them
And see if they arrive
One possible solution might be not send my notifications as data, but instead as standard notifications, which would then get handled by Firebase regardless of whether the app is running or not.
The downside of this approach is that they can't be shown in the foreground anymore
Digging through the logs I did come across this. Is number
supposed to be a float?
05-07 22:57:01.280 6508 9943 W Bundle : Key number expected Double but value was a java.lang.Integer. The default value 0.0 was returned.
05-07 22:57:01.281 6508 9943 W Bundle : Attempt to cast generated internal exception:
05-07 22:57:01.281 6508 9943 W Bundle : java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
05-07 22:57:01.281 6508 9943 W Bundle : at android.os.BaseBundle.getDouble(BaseBundle.java:1069)
05-07 22:57:01.281 6508 9943 W Bundle : at android.os.BaseBundle.getDouble(BaseBundle.java:1051)
05-07 22:57:01.281 6508 9943 W Bundle : at com.evollu.react.fcm.SendNotificationTask.doInBackground(SendNotificationTask.java:77)
05-07 22:57:01.281 6508 9943 W Bundle : at com.evollu.react.fcm.SendNotificationTask.doInBackground(SendNotificationTask.java:36)
05-07 22:57:01.281 6508 9943 W Bundle : at android.os.AsyncTask$2.call(AsyncTask.java:333)
05-07 22:57:01.281 6508 9943 W Bundle : at java.util.concurrent.FutureTask.run(FutureTask.java:266)
05-07 22:57:01.281 6508 9943 W Bundle : at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
05-07 22:57:01.281 6508 9943 W Bundle : at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
05-07 22:57:01.281 6508 9943 W Bundle : at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
05-07 22:57:01.281 6508 9943 W Bundle : at java.lang.Thread.run(Thread.java:764)
what does SendNotificationTask.java:77 have?
AFAIK, JS should pass double/float into native.
.setNumber((int)bundle.getDouble("number"))
I pass in 3 as number in my test cases
from FCM
fixed in v15.0.1
After update on 15.0.1 app crashed
@jurajkrivda step to reproduce?
Thanks @evollu. Could you update the sdk-26
branch (I'm using that branch)?
About the originally posted issue, I tracked down where the app was being force stopped. The notifications were stopping because of the force stop.
@tss101 I've merged changes into sdk-26
Many thanks @evollu!
Hi,
I have an an released with react-native-fcm, and I'm getting user reports that notifications work for a while, then just stop. I finally managed to get a log report of one of the incidents, and the message that comes up is this:
Once the message comes up, it continues coming, and no further notifications arrive
Googling around it seems this crops up most often when the app is force killed by a battery saving mechanism more common in phones like the OnePlus 3T.
But in this case there is no battery saving being applied, at some point this message pops up and the notifications stop (along with the foreground service the app runs while it is closed).
I've also tried the same code on Android 5.1 and it runs without issue
I'm using custom notifications for Android, with the following format