I implemented a background service for getting the sensor data in the log. i am getting the volume press event in dispatchKeyEvent()
method in the activity. But, i want to get the data even though the application is in background.
I tried with BroadcastReceiver
.
While click the volume key button, it should trigger a method when the application is in background(like the mediaplayer
app increase/decrease the sound).