How to call this even when the app hasn't even started
问题 So my app shows a notification icon on headset plugin, and it destroys itself also if the headset is removed. But that only works if the application has been opened. How could I make it so it detects the headphone plugin and runs the icon in the background? Here is the class the detects if the headset has been plugged in or not public class MusicIntentReceiver extends BroadcastReceiver { int NOTIFICATION_ID = 1234567890; NotificationManager mNotificationManager; @Override public void