3小时后Android设定通知 [英] Android Set Notification after 3 hours

查看:74
本文介绍了3小时后Android设定通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在申请提醒。如果用户单击警报按钮,则应在接下来的3个小时内设置警报,并在完成3个小时后在状态栏中显示通知。

i am making an reminder application. If a user clicks the alert button, the alarm should be set for next 3 hours and a notification should be shown in the status bar after 3 hours completion.

我想我必须使用警报管理器来执行此操作,但是我不知道如何在当前系统时间上增加3小时并为该时间设置通知。

I guess i have to use Alarm Manager to do this , but i dont know how to add 3 hours to current system time and set notification for that time.

推荐答案

关注

AlarmManager am = (AlarmManager) sContext.getSystemService(Context.ALARM_SERVICE);
    am.set(AlarmManager.RTC, System.currentTimeMillis() + 3*60*60*1000, sAlertSender);

这篇关于3小时后Android设定通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆