使用此代码,我尝试在 25/12/2012 - 15.15 将警报管理器设置为 Notify.class 星标,但是当我使用此代码时,Notify.class 不会启动。问题出在哪里?
Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
cal.set(Calendar.DATE,25);
cal.set(Calendar.MONTH,Calendar.DECEMBER);
cal.set(Calendar.YEAR,2012);
cal.set(Calendar.HOUR_OF_DAY, 15);
cal.set(Calendar.MINUTE, 15);
cal.set(Calendar.SECOND, 00);
Intent intent3 = new Intent(context, Notify.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0,intent3, 0);
alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
显现:
<activity android:name="Notify"></activity>
<receiver android:name="AlarmReceiver" >
<intent-filter>
<action android:name="com.example.AlarmReceiver" />
</intent-filter>