B4A Code Snippet FCM messages/notifications: Use Phonewakestate to throw notifications without delay - KMatle    Apr 26, 2021   (11 reactions) I mentioned that my fcm messages arrive without delay (data messages), but throwing a notification (even with high priority) doesn't work all the time when the phone sleeps.
Setting the phonewakestate before throwing the notification and releasing it after seems to work:
pws.PartialLock
D B4i Question B4i PhoneWakeState .KeepAlive(True) - cambol    Aug 23, 2019 how to set B4i
I can do in B4A
Dim pws As PhoneWakeState
pws.KeepAlive(True)
pws.ReleaseKeepAlive B4A Question How to turn off the screen(SCREEN_OFF)? - peacemaker (first post)    Feb 04, 2023 If you talk about the programmatic screen off like by the hardware switch - it's impossible, IMHO.
PhoneWakeState is about switching off the backlight variant. B4A Question Phone screen timeout problem - JohnC (first post)    Jun 17, 2020   (1 reaction) Have you tried using the PhoneWakeState: Dim PWS As PhoneWakeState PWS.KeepAlive(True) 'keep screen on while we do things (don't let screen timeout) ....do your timer work here.... PWS.ReleaseKeepAlive 'let the phone go to sleep now Keep in mind, if you forget to do the .Releas B4A Question B4X CloseRequest issue - Erel (first post)    Jan 16, 2022 You should use PhoneWakeState for that. Italian Non mandare in pausa l'applicazione - MarcoRome (first post)    Jan 27, 2024   (1 reaction) 'No standby
Dim nowake As PhoneWakeState
nowake.KeepAlive(True) B4A Question Turn on the screen of the device from my program - vecino (first post)    Nov 17, 2022 With PhoneWakeState.KeepAlive it should turn on the screen, and it does turn on, but it only works on my phone. I've tried it on several phones from some customers and it hasn't worked on any of them :rolleyes:
Is there anything else to be aware of? B4A Question Freezing app while phone screen off - Erel (first post)    Sep 11, 2022 You need to use PhoneWakeState to prevent the CPU from sleeping. Example: https://www.b4x.-location-tracking.99873/#content
Note that phones do not like apps that prevent the CPU from sleeping as it impacts the battery. Many phones will kill the app at some point. B4A Question Need to prevent app close screen until finish some tasks. - LucaMs (first post)    Aug 12, 2023   (2 reactions) Private mPhoneWakeState As PhoneWakeState Private Sub B4XPage_Background mPhoneWakeState.ReleaseKeepAlive End Sub Private Sub B4XPage_Foreground mPhoneWakeState.KeepAlive(True) End Sub B4A Question [Service Module] Device in sleep mode does not work! - Roberto P. (first post)    Nov 06, 2016   (1 reaction) Hi to all,
finally, using PhoneWakeState it is unable to prevent the device to go to sleep and active services are able to maintain active communication or jobs
It may be useful here are the steps I followed:
1- add the following permission in AddPermission (android.permission.WAKE_LOCK) files i Page: 1   2   3   4   5   6   7   Powered by ColBERT |