Accelerometer in the background?

Is it possible to read the accelerometer sensor in android when the application is in the background? I read that I can’t get the touch inputs while in the background, is that also true?

+3
source share
3 answers

yes, you can read the sensors but you must run the service http://developerlife.com/tutorials/?p=356

how to enter user data entry into android service

+2
source

Since applications that mute your phone when placed upside down and other applications that launch when you make a specific gesture on the screen, I think that both of the things you ask for are doable.

0
source

Even activity can be performed in the background, you just need to make sure that you DO NOT unregister the event listener with onPause ().

A service is nothing more than activity without a user interface. Thus, in this case it may be “better” to create a service, but it is certainly not necessary if you feel the overhead of adding a service, and the connections connected with it are not worth it, especially on air if you do too much may cost you in terms of performance and energy consumption.

0
source

All Articles