I have tried, but I can't find it. All I find are SCREEN_OFF event listener.Search for "WAKE_LOCK", PhoneWakeState
B4X:AddPermission(android.permission.WAKE_LOCK)
So I can not turn screen power off?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.
Recent years and Android versions Google has limited the programmatic actions that may concern the security, private data access and so on.can not turn screen power off
How could apps like whatsapp and telegram lock (or turn off) the display when putting the phone at the ear to hear from the internal speaker?No. You cannot turn off the screen programatically.
It's just system proximity sensor work during call is active.when putting the phone at the ear
thanks for your replay..It's just system proximity sensor work during call is active.
oh sure I already tried for 2 days so far, the "proximity sensor" is a sensor so its read not write, I mean you can find out if the user put the phone to his ear but you need some code to lock the displayFirstly for any question - just try to search the forum for the key words, like "proximity sensor".
And also Google search engine can help.
You may have to use device-administrator-library: https://www.b4x.com/android/forum/threads/device-administrator-library.19208/ Lock Screen app in Play Store too uses the administrator library:oh sure I already tried for 2 days so far, the "proximity sensor" is a sensor so its read not write, I mean you can find out if the user put the phone to his ear but you need some code to lock the display