我尝试在我的应用程序中做闹钟,但是当有电话锁时,活动不会像标准闹钟那样开始。我能做些什么来决定这个问题?
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 5);
Intent intent = new Intent(this, AlarmReceiverActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
12345, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager am =
(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);