Back to project page HeadphoneController.
The source code is released under:
GNU General Public License
If you think the Android project HeadphoneController listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ca.mbabic.headphonecontroller.services; /*from w w w . j ava2 s. com*/ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class MediaStateChangeReceiver extends BroadcastReceiver { private static final String TAG = ".services.MediaStateChangeReceiver"; private static MediaButtonListenerService mListenerService = null; @Override public void onReceive(Context context, Intent intent) { String action; action = intent.getAction(); Log.d(TAG, "Received broadcast."); if (action.equals("com.android.music.playstatechanged")) { if (mListenerService != null) { mListenerService.registerAsMediaButtonListener(); } } } public void setService(MediaButtonListenerService mbls) { mListenerService = mbls; } }