List of usage examples for android.media AudioManager ACTION_HEADSET_PLUG
String ACTION_HEADSET_PLUG
To view the source code for android.media AudioManager ACTION_HEADSET_PLUG.
Click Source Link
From source file:Main.java
public static String getWiredHeadsetUpdateAction() { if (Build.VERSION.SDK_INT >= 21) { return AudioManager.ACTION_HEADSET_PLUG; } else {/*w ww . j av a 2s. co m*/ return Intent.ACTION_HEADSET_PLUG; } }
From source file:com.cyanogenmod.settings.otgtoggle.UsbDeviceMonitorService.java
@Override public void onCreate() { super.onCreate(); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mUsbManager = (UsbManager) getSystemService(USB_SERVICE); mStateMachine = new UsbPortStateMachine(this); mStateMachine.setDbg(true); // XXX mStateMachine.start();/*from w ww .j av a 2 s.c o m*/ IntentFilter filter = new IntentFilter(); filter.addAction(AudioManager.ACTION_HEADSET_PLUG); filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED); filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED); registerReceiver(mDeviceStateReceiver, filter); }