I am sending custom broadcasts from AppWidgetProvider class:
intent = new Intent();
intent.setAction("packagename.intent.action.SET_VOLUME_STATE");
context.sendBroadcast(intent);
and listening for them in BroadcastReceiver class:
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals("packagename.intent.action.SET_VOLUME_STATE"))
{
//do stuff
}
}
and have also registered the receiver with intent filter in manifest file. The problem is I am receiving the broadcast intent very late ~20-30 seconds after it is broadcast and sometimes it is sooner than that. I expect to receive the broadcast immediately and not lag behind. Am i missing something?