I am facing delayed notification when phone is ideal and not in use for few minutes. Even sometimes I am getting notification when phone start to use, not before that. Is it app issue or phone settings issue? I tried to change phone settings like Turn Off Adaptive Battery, Don’t Optimize for that app. I checked app side; I didn’t find anything wrong from app. Can anyone help me please?
Thanks
To solve this problem, I had to set the priority of the messages from the backend to high priority.
Check this out: https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message
Related
My Firebase Messaging Service App fires the onMessageReceived when the App is in the background, foreground and locked (with the screen on). The only time it stops firing is when the screen is off (even though the app is still running in the background). How do I get my onMessageReceived to be called when the screen is off ? All the answers I've seen have pointed to using a wake lock which I tried but this did not work. Is there a work around for this or is a custom solution the only way to go ?
I am making a type of chat application similar to whatsapp, so i need the functionality of events triggered even when the screen is off. If FCM cannot do this can anyone recommend an alternative service or API ?
All help appreciated
Thanks
Posting a solution for reference in case anyone else has this issue.
On Android 6.0 if you add the app to the 'white list' under Settings->Smart Assist->Background Task Cleaner, you get the notifications when the screen is off. No wake locks required.
I would not have thought about looking at the general App settings if it wasn't for your comment #Diego Giorgini so thank you very much.
With a fresh install app on my Samsung Note 5 device and also on my emulator, some notifications was sent via the Firebase console are received properly on those 2 devices.
But after a day, my emulator was reopened, my phone was reconnected to the Wifi, I started creating some few notification messages on Firebase console again, but those devices did not receive any message from Firebase.
I turned off and turned on my phone's Wifi, then the phone received those notifications. I turned on and turned off plane mode on my emulator, then the emulator received those notifications. Is there something wrong with my app? Or with Firebase? (I already use WAKE_LOCK permission). Any suggestion?
Thanks!
It seems to work fine now after I changed my device's Wifi connection.
From #AL's comment:
There might be a chance that the Android device is connected to the
Wifi, but your Wifi needs something like a refresh for the internet
connection to work again, which is the same case for the devices
connected to it.
I still not sure why, but his comment make this works.
Great to know that, #AL gave a hint of the problem and you got it working too. I'm here for putting some of my thoughts here regarding your issue.
As you've worked with push notification already, I think you know pretty much about how this works actually. If you want a short brief, you might take a look at this answer.
Now, you already have known, you need to get a push registration ID from FCM when your application starts. This push registration ID, is the unique ID by which FCM knows when and how to send you a push notification. This push registration ID doesn't change every time you launch your application, but yes, it changes some times. When your push registration ID has been changed, but you couldn't get your new push registration ID from FCM, the push notification won't work properly in that time. This is usually a network issue though, but don't panic if that happens.
Another thing I need to point out is, push notification is not always guaranteed to be received in your device/devices. So if you're performing some action when a push notification is received in your application, you might need to make the action fail safe too (e.g. you might consider polling after a certain time if no push is received).
I've followed android-hive's guide on push-notifications. And I've done my own app and implemented the necessary stuff to receive a push.
It works just fine, I get the push and a message and everything but the thing is, I want the screen to just light up when I get a push. Even in the original androidhive-code wake-lock didn't work for me. There must be some easy way to just make the screen wake up when i get a new push-notification right?
Thank you very much for all your help!
I put in reference this Link
I implemented it it works but am facing troubles:
first sometimes I need to restart the android emulator so the push notification could be delivered when the emulator is restarted the push notification work properly.
after a while the push notification does not work and it need about 15 min to the push notification to get delivered. if I restart the emulator the push notifications get delivered and so on...
what do you think the problem here?
Its your wifi router probably, check the description here
https://play.google.com/store/apps/details?id=com.andqlimax.pushfixer
I opened an issue to google here:
https://productforums.google.com/forum/#!category-topic/nexus/connecting-to-networks-and-devices/fslYqYrULto
and they agree there is a TCP timeout on some conditions.
if you are expecting a notification but there a huge delay in android emulator.
You can perform following step to get instant notification.
Turn off the mobile data in Emulator then turn it on again, you will get the notification as soon as you turn it on
hope this helps :)
I had develop an android app that allow user to request info from their phone based on chrometophone example.
Everything is working well but i noticed that c2dm message only sent once to the device and subsequence c2dm will only reach phone after screen unlock.
This make me annoy as my app required to get data from phone without unlock screen multiple times.
Anyone can help on this?
Thanks and sorry for my bad English.
thanks lonel for reply.
I think I found the answer. there is a parameter called "delay_while_idle", chrometophone set this param to true so C2DM will send only when phone not in IDLE.
If I understand your question, you want to send messages to the phone while it is in an idle state.Sadly, you can't do it because C2DM messages are only received when the phone is not idle (i.e. unlocked).
On top of that the devices stop the wifi while they have the screen locked and they only bring it up from time to time.