Wake lock on receiving pushnotification. Is there an easy way? - android

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!

Related

Delayed push notification on Android phone

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

Show a Call Screen/Wake up device after receiving FCM onMessageReceived() (WITHOUT tapping on notification)

Hi I am making an app using OpenTok and FCM. Right now, I am able to successfully receive push notifications in onMessageReceived and handle those data however I want to.
My question is, I want to show a "Calling Screen" (as in the screen you get when someone is calling you) whenever I receive a push notification. Can someone point me to the right direction? I assume I need to use a BroadcastReceiver but in conjunction with what? Wakeful services?
My biggest problem right now is how do I show the calling screen when the phone is locked or when my application is killed or in the background.
If anyone can point me in the right direction, it would be greatly appreciated.
Thank you

Firebase Messaging Service does not receive messages when the screen is off

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.

Android Push Notification when App is not running

for my android app I want to inform the user when something on a server is happening, even when the App is not running. I've read some stuff about alternatives for C2DM but if I understand it right, things like polling or persistent connection only work if the App is running right?
Thanks.
well actually app can be "thrown off" but if things are running normal can be done with a Service = trick is there is a lower-priority "service" that is not as likely to get dumped

Android C2DM notification top corner?

I know C2DM seems to be messaged about to death, but I can not find my issue with the others listed here at stackOverflow.
So everything works, I register, I get my AuthCode, I send the Push, I receive the push. The only thing i noticed though is that I never see the push in the top corner screen of the of the phone where like the SMS messages do. Is that something I have to code specifically? if so, where can I find resources to do that ?
I have only done a Week's worth of android development, so I am a little green with the basics if this was covered somewhere in 101.
Yes, if you want a notification to appear, you will need to code that. Take a look at the NotificationManager api.

Categories

Resources