Sub GetScreen
If Not(IsScreenOn) Then
startactivity("what ever activity name")
End If
End Sub
B4X:
Sub IsScreenOn As Boolean
Dim R As Reflector
R.Target = R.GetContext
R.Target = R.RunMethod2("getSystemService", "power", "java.lang.String")
Return R.RunMethod("isScreenOn")
End Sub
with this in the "what ever activity" activity resume and pause
B4X:
Dim r As Reflector
r.Target = r.GetActivity
r.Target = r.RunMethod("getWindow")
r.RunMethod2("addFlags", 6815872, "java.lang.int")
and the release
B4X:
Dim r As Reflector
r.Target = r.GetActivity
r.Target = r.RunMethod("getWindow")
r.RunMethod2("clearFlags", 6815872, "java.lang.int")
works great on Android 5 but on Android 7 it does not wake the phone.
Any pointers as to why appreciated
been playing with this but I've hit a brick wall
I,ve uploaded a sample file, the sample works on a timer to wake the phone.
it supposed to wake the phone up and show Activity ,this works on Android <7 but not on Android 7.
the timer is only for testing purposes , the actual app is to big to upload so I created a sample app that recreates what is (or not) happening.
the project a driving timer for HGV drivers in the EU and is using gps in a service to wake up phone when certain conditions are met.
the phone i'm testing on Huawei p8 lite, never had a problem on previous Huawei's or Samsung,Lenovo just this one
again great stuff in here and the help is phenominal