Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Intent; import android.media.AudioManager; import android.os.Build; public class Main { public static String getWiredHeadsetUpdateAction() { if (Build.VERSION.SDK_INT >= 21) { return AudioManager.ACTION_HEADSET_PLUG; } else { return Intent.ACTION_HEADSET_PLUG; } } }