我已经在broadcast receiver
的onResume中注册了fragment
,但是根本没有触发,虽然调用了onResume()
方法,但是在注册后broadcast receiver
无法正常工作onResume()
。与activity
的情况相同,我在某些activity
中使用了此代码,但从未调用过broadcast receiver
。第一次触发是因为我也在onCreate中注册了广播接收器,但是即使我在onResume中再次注册了它,也不会调用onResume
@Override
public void onPause() {
super.onPause();
LocalBroadcastManager.getInstance(this).unregisterReceiver(tagAddedToSearch);
LocalBroadcastManager.getInstance(this).unregisterReceiver(tagRemovedFromSearch);
}
@Override
public void onResume() {
super.onResume();
Log.e(" on resume","onresume tag serach");
LocalBroadcastManager.getInstance(this).registerReceiver(tagRemovedFromSearch,
new IntentFilter("removeFeedTag"));
LocalBroadcastManager.getInstance(this).registerReceiver(tagAddedToSearch,
new IntentFilter("addFeedTag"));
////check app update of app
// CheckAppUpdate.with(getContext()).onUpdateNeeded(getContext()).check();
}