Get android sensor data only if another app asks for it

114 Views Asked by At

I'm building a data collection system in Android, in order to understand user context and intents. I would like to get as much data out as possible while maintaining minimal impact on battery. Hence, it would be great if I could get sensory data only if some other app requested for it and it's extracted anyhow.

For example, every time my navigation app gets a GPS sample, I will get it too (instead of registering a listener to GPS and getting all samples).

Same for accelerometer, gyroscope, step detector and activity recognition.

Is it possible?

Thanks! Omri

1

There are 1 best solutions below

0
On BEST ANSWER

For GPS you can use the passive provider which does exactly what you described: http://developer.android.com/reference/android/location/LocationManager.html#PASSIVE_PROVIDER

For the other sensors I don't think this exists but you can choose a very slow update rate.