4
嗨,我一直在研究android中的报警管理器,并想知道是否有设置闹钟的具体时间(或可以使用通知管理器)在特定时间例如明天下午12点关闭。 下面的代码将闹钟设置为从现在开始的5秒钟,所以将它设置为像12点这样的东西,你可以做一些类似于12:00:00的事情吗?Android报警管理器
Intent intent = new Intent(this, OnetimeAlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, REQUEST_CODE, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (5 * 1000), sender);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();
非常感谢我会尽力,并与合作那稍后。 – SamB09
没问题。不要忘记,你可以upvote和接受回应:)这将保持人们的动机回答你的问题 – emmby
我试过了,它的工作非常感谢。 – SamB09