如何在Android中处理报警通知?通知、如何在、Android

2023-09-13 00:55:06 作者:蕞羙吥過初葙見

我开发一个媒体播放器应用程序为Android,为此我需要处理的任何报警通知,并根据我会暂停我的播放。当警报被闲置或开除,我会再继续播放。

I'm developing an media player application for Android, for which I need to handle any Alarm notification, and based on that I'll pause my playback. When the Alarm in snoozed or dismissed, I'll then resume the playback.

我GOOGLE了很多的报警处理,但我发现,这个解决方案能够通过code报警通知,设定的意图,然后处理它。然而,没有在那里我能找到刚处理警报通知的一部分。我并不需要设置闹钟上,它可能已经由用户设置的,我也不需要编程。所有我需要的只是处理的通知。

I googled a lot for the Alarm handling, but what I found was the way to enable Alarm notifications through code, set the intent and then handle it. However, no where could I locate just handling the Alarm notification part. I don't need to set the Alarm on, it could've been set by the user, and I don't need to programmatically. All I need is just handle that notification.

在这个任何想法将是非常有用的?

Any ideas on this would be extremely useful?

谢谢, Asheesh

Thanks, Asheesh

推荐答案

HI Asheesh Vashishtha,

HI Asheesh Vashishtha,

纠正我,这一点,但AFAIK每当任何其他应用程序,即使它是闹钟,被激活时,你的活动一定会去的背景。所以我想ü可以覆盖将OnPause OnResume 函数来把你的code位。至于暂停或其他东西而言,它们都将导致警报活动被破坏掉了(或暂停,不要很了解它),你的活动将得到恢复。所以这不会是ü关心的问题!

Correct me on this, but AFAIK whenever any other application even if it is the alarm clock, is activated, your activity will surely go in background. So i guess u can override the OnPause and OnResume functions to put your bit of code. As far as snooze or other things are concerned, they all will result in the Alarm Activity getting destroyed(or paused, don know much about it) and your activity will get resumed. So that wont be a matter of concern for u!

希望这有助于...