我使用的广播接收机,用于当设备被关闭并重新开启一些行动,但他们不是working.These在清单文件的接收器:
<receiver android:name=".ShutdownReceiver" >
<intent-filter>
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
</intent-filter>
</receiver>
<receiver android:name=".RestartReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
这些是相应的类:
public class ShutdownReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
Log.d("In","Switched Off");
}
}
public class RestartReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
SecureMessagesActivity.ToDoOnMobileSwitchOn();
Log.d("In","Switched On");
}
}
请帮助me.Thanks提前。