I have a simple BroadcastReceiver that I configure in my onResume method of my activity.
@Override
protected void onResume() {
super.onResume();
LocalBroadcastManager.getInstance(this).registerReceiver(mNotificationReceiver, new IntentFilter(QuickstartPreferences.NEW_NOTIFICATION));
}
I unregistered on onPause:
@Override
protected void onPause() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(mNotificationReceiver);
}
I have a background service that sends a broadcast message:
Intent newNotification = new Intent(QuickstartPreferences.NEW_NOTIFICATION);
newNotification.putExtra("title", data.getString("title"));
LocalBroadcastManager.getInstance(this).sendBroadcast(newNotification);
My question is: if the background service sends a message when activity is not open, and now that the action is resumed, will it be able to receive broadcast messages? If not, how to maintain a queue for storing transmitted messages when activity is not open?
source
share