0
我在沒有收到廣播意圖的單例類中有一個廣播接收器。Singleton類中的BroadcastReceiver沒有收到意圖
單例使用上下文進行初始化(即getInstance(context))。
我調用getContext()。sendBroadcast(intent);但BroadcastReceiver沒有得到任何東西。我已經確認意圖過濾器是匹配的。
我註冊了接收器的方式是在我的單身構造像這樣
private class Singleton(Context context) {
context.registerReceiver(mReceiver, INTENT_FILTER);
....
private onDestroy(Context context) {
context.unregisterReceiver(mReceiver);
....
這是怎麼回事!?