我尝试在我的 android 设备中通过 eclipse 运行此代码。但它没有设置警报。已添加 Android 权限。可能是什么问题!
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 5);
Intent intent = new Intent(this.context, AlarmAction.class);
PendingIntent pendingintent = PendingIntent.getBroadcast(this.context, 0, intent, 0);
this.alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingintent);