Activity Recognition - how to use it

260 Views Asked by At

I'm looking for a solution which safes the battery in my "location based app". I got a question to the Activity Recognition, which provides Google for Android. Actually I got the problem that my phone will only recognize my current "activity" when the phone is awake. When screen turned off, the recognition doesn't do it's job. After unlocking the phone (screen on) the recognition resumes. Is that normal? I can't imagine, because the API provides activities like "riding bike" - who had ever his screen on while riding a bike?!

Is there any other good approach how to check if somebody is driving a car? Will it be possible with other sensors (like accelerometer)? Please let me know. I'm grateful for every little advice.

Thanks in advance.

1

There are 1 best solutions below

0
On

In order to save user's device battery, activity recognition detection stops once the device goes to sleep. If your application is some kind of Fitness app that user turned on (and knows that it may be draining the battery) you can keep tracking user's activity from your service using one of the following methods: Keeping the Device Awake.