C ckLeong New Member Licensed User Aug 24, 2017 #1 My app simply need to detect any motion of the device while screen is off.
Erel B4X founder Staff member Licensed User Longtime User Aug 25, 2017 #2 Create a foreground service and use PhoneWakeState to acquire a partial lock. This will prevent the phone from sleeping and will allow you to use PhoneSensors to monitor movements. It is likely to not work on all devices. Another option: https://www.b4x.com/android/forum/threads/physical-activity-recognition-detection.42481/#content Upvote 0
Create a foreground service and use PhoneWakeState to acquire a partial lock. This will prevent the phone from sleeping and will allow you to use PhoneSensors to monitor movements. It is likely to not work on all devices. Another option: https://www.b4x.com/android/forum/threads/physical-activity-recognition-detection.42481/#content