Android Scheduled Notifications

非 Y 不嫁゛ 提交于 2019-11-28 10:37:25

问题


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


回答1:


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.

There is an Example.



来源:https://stackoverflow.com/questions/16548999/android-scheduled-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!