我有 BroadcastReceiver (NetworkListener)。
public class NetworkReceiver extends BroadcastReceiver {
Context context;
public static NetworkReceiver instance = new NetworkReceiver();
public static InnerObservable observable = instance. new InnerObservable();
...
此接收器发送通知:
@Override
public void onReceive(Context ctx, Intent intent) {
Log.d("tag", "onReceive");
NotificationManager notif = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(android.R.drawable.ic_dialog_alert,"bla-bla-bla",System.currentTimeMillis());
清单文件:
<receiver
android:name="com.mypckg.network.NetworkReceiver" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
它工作正常。但手机重启后,它继续工作。如何避免?