を実行していないされた後、私はこの権限を使用:Androidの再起動の放送Reciverが
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
を、受信機がある:
<receiver android:name=".auth.NotificationBroadcast" android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
とコード内の受信機は、次のとおりです。再起動後
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("BroadcastReceiverBroadcast--------------------ReceiverBroadcastReceiverBroadcastReceiver----------------BroadcastReceiver");
if (intent != null) {
String action = intent.getAction();
switch (action) {
case Intent.ACTION_BOOT_COMPLETED:
System.out.println("Called on REBOOT");
// start a new service and repeat using alarm manager
break;
default:
break;
}
}
}
ロリポップではまだ呼び出されていませんが、マシュマロでは実行中です。