Android: Does BroadcastManager have queues?

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?

+4
source share
2 answers

LocalBroadcast , . onPause() , . sendBroadcast() , , false, .

, , .

+1

, . :

, activity running / , , sharedPreference, , , , receives <<24 > .

+1

Source: https://habr.com/ru/post/1622419/


All Articles