英文:
Which Android Classes can be used to enable an action for every event in a specific calendar?
问题
我想查看一下这个问题是否可行。我想创建一个Android应用,允许用户为每个用户指定的日历事件启用“勿扰模式”。我已经研究了AlarmManager类,但似乎无法实现此目的。一个单独的AlarmManager实例可以用于一个事件的一半(打开勿扰模式)。另一个AlarmManager实例将需要关闭勿扰模式。这将需要针对指定日历中的每个事件(数量可变)重复执行。是否有更简单的方法来解决这个问题,或者我对问题的理解有误?我知道在原生Android中已经实现了这一点,但一次只适用于一个日历。如果有更好的解决方案,您能指点我适当的Android SDK类吗?无需示范代码。谢谢。
英文:
I'm looking to see if this problem is feasible. I want to create an Android app that allows a user to enable Do Not Disturb for every event in user-specified calendars. I've already looked into the AlarmManager class, and it does not seem to work for this purpose. A single AlarmManager instance would work for one half of one event (turning Do Not Disturb On). Another AlarmManager instance would be required to turn Do Not Disturb off. This would have to repeat for every event (which is variable) in the specified calendars. Is there an easier approach to this, or am I looking at this problem all wrong? I know that this has been done in stock Android, but it only works for one calendar at a time. If there is a better solution to this, could you point me toward the proper Android SDK classes? I do not need a code example. Thanks.
专注分享java语言的经验与见解,让所有开发者获益!
评论