我有一个简单的BroadcastReceiver,我在我的Activity的onResume方法中设置。Android:BroadcastManager是否有队列?
@Override
protected void onResume() {
super.onResume();
LocalBroadcastManager.getInstance(this).registerReceiver(mNotificationReceiver, new IntentFilter(QuickstartPreferences.NEW_NOTIFICATION));
}
我注销了接收器上的onPause:
@Override
protected void onPause() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(mNotificationReceiver);
}
我有发送广播消息,这个后台服务:
Intent newNotification = new Intent(QuickstartPreferences.NEW_NOTIFICATION);
newNotification.putExtra("title", data.getString("title"));
LocalBroadcastManager.getInstance(this).sendBroadcast(newNotification);
我的问题是,如果后台服务广播活动未打开时的消息以及活动恢复时的消息,它是否能够拾取广播的消息?如果不是,当Activity未打开时如何维护队列以存储广播的消息?
两种选择:使用'Notification's或“local bound Service”模式 – pskink