Android的计划通知通知、计划、Android

2023-09-04 03:59:13 作者:⒈亇亽旳仦緈鍢

我要建一个应用程序,我需要安排的通知记住用户访问应用程序。予需要该通知中显示提前一个月的最后一次该应用,使用

I'm building an app and I need to schedule a notification that remember the user to access the app. I need this notification to be shown a month ahead of the last time the app was used

推荐答案

AlarmManager 访问系统报警服务。随着AlarmManager的帮助下,你可以安排执行code的未来。 AlarmManager对象不能直接实例但它可以通过调用 Context.getSystemService(Context.ALARM_SERVICE)检索。 AlarmManager总是注册意图。当警报响起时,已注册AlarmManager的意图,是由系统自动播放。这个意图启动目标程序,如果它没有运行。建议使用AlarmManager当你想你的应用程序code在特定时间运行,即使你的应用程序当前未运行。

AlarmManager has access to the system alarm services. With the help of AlarmManager you can schedule execution of code in future. AlarmManager object can’t instantiate directly however it can be retrieved by calling Context.getSystemService(Context.ALARM_SERVICE). AlarmManager is always registered with Intent. When an alarm goes off, the Intent which has been registered with AlarmManager, is broadcasted by the system automatically. This intent starts the target application if it is not running. It is recommended to use AlarmManager when you want your application code to be run at a specific time, even if your application is not currently running.

有一个为例。