How do I call a function in a plugin or initialize a plugin from a broadcast receiver?
public void onReceive(Context context, Intent intent) {
try {
int st = intent.getIntExtra("state", -1);
if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
if(st==1)
{
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
source
share