我写了Broadcast Receiver
,效果很好,但有问题,当我重新启动手机时,Broadcast Receiver
再次发光。
我的目的是
当手机重新启动时,它只能Boot_Completed
语句:
Toast.makeText(context,"Works",Toast.LENGTH_LONG).show();
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
Toast.makeText(context,"works _ second",Toast.LENGTH_LONG).show();
}
我的xml文件:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name=".Alarmikinci">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>