D dgoss Member Licensed User Longtime User Sep 9, 2017 #1 using this Code: Sub GetScreen If Not(IsScreenOn) Then startactivity("what ever activity name") End If End Sub Code: 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 Code: Dim r As Reflector r.Target = r.GetActivity r.Target = r.RunMethod("getWindow") r.RunMethod2("addFlags", 6815872, "java.lang.int") and the release Code: 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
using this Code: Sub GetScreen If Not(IsScreenOn) Then startactivity("what ever activity name") End If End Sub Code: 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 Code: Dim r As Reflector r.Target = r.GetActivity r.Target = r.RunMethod("getWindow") r.RunMethod2("addFlags", 6815872, "java.lang.int") and the release Code: 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
Erel B4X founder Staff member Licensed User Longtime User Sep 10, 2017 #2 You can use PhoneWakeState to turn the screen on. Upvote 0
D dgoss Member Licensed User Longtime User Sep 11, 2017 #3 Erel said: You can use PhoneWakeState to turn the screen on. Click to expand... hi Erel sorry took so long to reply but working my day job, will look into your suggestion again thx for the quick reply Upvote 0
Erel said: You can use PhoneWakeState to turn the screen on. Click to expand... hi Erel sorry took so long to reply but working my day job, will look into your suggestion again thx for the quick reply
D dgoss Member Licensed User Longtime User Sep 13, 2017 #4 Hi all 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. any help appreciated Attachments wake phone test.zip wake phone test.zip 12.2 KB · Views: 591 Upvote 0
Hi all 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. any help appreciated
Erel B4X founder Staff member Licensed User Longtime User Sep 13, 2017 #5 I haven't checked your code. A timer is not good enough. You need to call StartServiceAt or better SetExactAndAllowWhileIdle: https://www.b4x.com/android/forum/t...estartatexact-not-accurate.65117/#post-412286 Start an activity from the service and acquire a wake lock with PhoneWakeState. Upvote 0
I haven't checked your code. A timer is not good enough. You need to call StartServiceAt or better SetExactAndAllowWhileIdle: https://www.b4x.com/android/forum/t...estartatexact-not-accurate.65117/#post-412286 Start an activity from the service and acquire a wake lock with PhoneWakeState.
D dgoss Member Licensed User Longtime User Sep 13, 2017 #6 Erel said: I haven't checked your code. A timer is not good enough. You need to call StartServiceAt or better SetExactAndAllowWhileIdle: https://www.b4x.com/android/forum/t...estartatexact-not-accurate.65117/#post-412286 Start an activity from the service and acquire a wake lock with PhoneWakeState. Click to expand... Hi Erel Thx For reply 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 Upvote 0
Erel said: I haven't checked your code. A timer is not good enough. You need to call StartServiceAt or better SetExactAndAllowWhileIdle: https://www.b4x.com/android/forum/t...estartatexact-not-accurate.65117/#post-412286 Start an activity from the service and acquire a wake lock with PhoneWakeState. Click to expand... Hi Erel Thx For reply 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