AlarmManeger在重启后没有启动,但应该启动。 我该怎么做? AndroidManifest:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name=".AlarmEngine.AlarmManagerHelper" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
广播接收器:
@Override
public void onReceive(Context context, Intent intent)
{
setAlarms(context);
}
public static void setAlarms(Context context)
{
cancelAlarms(context);
AlarmDBHelper dbHelper = new AlarmDBHelper(context);
List<AlarmModel> alarms = dbHelper.getAlarms();
for (AlarmModel alarm : alarms)
{
PendingIntent pIntent = createPendingIntent(context, alarm);
...
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pIntent);
答案 0 :(得分:0)
我修正了将移动的应用程序移到了手机的内存中。
我替换了这个:
android:installLocation="preferExternal" >
关于这个:
android:installLocation="internalOnly" >