Android 稍后通知用户
我想在android中创建一个应用程序,其中用户选择未来的某一天,然后,当那一天到来时,他会收到通知(我知道这可以通过日历或注释来完成,但这并不对我来说很重要)。
我有两个与前一个相关的问题
:我该如何执行通知?我在其他地方读到过有关向用户的 Google 日历添加事件的信息 - 但这不是标准的。我是否应该实施一项服务来检查这一天是否已经到来并添加通知?
b.正如我所写,我只关心一天,而不关心时间。这给我带来了以下问题:我应该什么时候通知用户以免打扰他?当应用程序只知道通知的日期(而不知道时间)时,它如何确定当天的什么时间实际通知用户?如果用户睡着了怎么办?是否可以添加“静音”通知,这样用户就不会被打扰?
TIA, 塞拉菲姆
I want to create an application in android in which the user selects a certain day in the future and then, when that day arrives he will get a notification (I know that this can be done through the Calendar or the notes but that doesn't matter in my case).
I have two problems concerting the previous:
a. How should I implement the notification ? I read elsewhere about adding events to the Google Calendar of the user - but that is not standard. Should I implement a service that checks to see if that day has arrived and add the notificatin ?
b. As I wrote, I care about day only, and not time. This generates the following problem for me: When should I notify the user in order to not bother him ? When the application knows only the day of the notification (and not the time) then how can it determine at what time in that day to actually notify the user ? What if the user is asleep ? Is it possible to add a "silent" notification so that the user won't be bothered ?
TIA,
Serafeim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这两个问题都可以通过“状态栏通知”解决
http://developer .android.com/guide/topics/ui/notifiers/notifications.html
您可以为此添加声音以提醒用户。
如果用户“睡着了”,即手机处于静音状态,我相信通知不会发出声音。
通知不需要一天中的某个时间,因为您可以在一天的一开始就“通知”,并且用户在当天第一次查看手机时就会看到它,因此时间无关紧要。
您将有一个服务运行来检查数据是否正确,然后启动此通知。可能有一个针对某些给定事件的事件侦听器,该事件将启动您的服务,然后检查日期,如果是这样,则发布您的通知!
这是我的教程:
http://blog.blundellapps.com/notification-for-a -user-chosen-time/
享受吧!
Both problems are solved by a 'status bar notification'
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
You can add a sound to this to alert the user.
If the user is 'asleep' i.e. the phone is on silent I believe the notification won't make a sound.
A notification does not need a time of day as you can 'notify' at the very start of the day and the user will see it when they first check there phone that day, so time is irrelevant.
You will have a service that runs to check the data yes, then start this notification. It may be possible to have an event listener for some given event that would start your service that would then check the date, and if so post your notification!
Here is my tutorial on this:
http://blog.blundellapps.com/notification-for-a-user-chosen-time/
Enjoy!