Android smart power management using sensor data

I am working on an Android app that needs to be scanned regularly near Wi-Fi hotspots. Currently, the scan happens every 2-3 minutes, which requires registration BroadcastReceiver

to capture the scan results, call the method WifiManager

startScan

and process the results (which also requires network calls in my case). This cycle consumes a lot of power and I want to improve my power consumption by implementing a smart power policy for the application.

Aside from scanning only during "hours of operation" (eg stopping a cycle at night), I am thinking of using the accelerometer through SensorManager

to determine if the device is stationary (placed on a table) or in motion (eg in the user's pocket while walking). Then, by detecting if the device is moving, I can adjust the scan rate (decrease when stationary and increase when the device is in motion).

I have several questions on this matter:

1) Would tracking the accelerometer data on a regular basis be more energy efficient than running a scan cycle every 3-5 minutes? How much energy will the accelerometer track really cost?

2) How to determine if the device is stationary or in motion? I have seen a lot of questions on the internet talking about vibration and tilt detection, but there is no information on natural motion detection. Also, how often should I try the sensor?

+3


source to share


2 answers


I think the best way is to use a class ActivityRecognitionApi

included in Google Play Services, which are optimized for such purposes. This class provides an: method requestActivityUpdates

that is optimized to return device state with minimal power consumption.



Actions are detected by periodically waking up the device and reading short bursts of sensor data. It uses only low power from the sensors to ensure minimal energy use.

+1


source


I am the second Fuwad Wahabit to answer your question. I would recommend taking another approach to your users' track and activity accelerometer. Id integrates a free SDK (available online), for example: 1. Tranql 2. Neira 3. Atuma Some of these SDKs send you user activity information as soon as they appear and use less than 1% of your battery.



0


source







All Articles