开发者

Controlling Alarm from 2 diff applications - Android

I need help in my android app development.

It goes something like this, I will be having two separate applications (2 projects). In one application, i have to start a repeating alarm and in the other application i have to cancel the same alarm that was started in the first application.

The Android documentation says, the same pending intent and the intent object that was used to start the alarm should be used the cancel the alarm.

So in this scenario, the pending intent and the intent object that was used to start the alarm will belong to application1 so i cannot used the same objects in application2

How do I proceed?

开发者_如何学运维In summary -

The problem is, I need to start a repeating alarm from one application and i have to cancel the same alarm from another application.

Can this be done. If so, How?

Thanks in advance.

ifreeman


It is not that straightforward. Only original activity can cancel the alarm.

So I think you can configure a custom broadcast. When the second activity needs to cancel an alarm it will send this broadcast. The first activity will be listening to the broadcast and cancel the appropriate alarm on receiving it.


I guess you can do. Alarms are considered as same if intents passed to them via pending intent are same. filterEquals method of Intent class defins if intents are same or not. If intents are same then alarms are same so u can cancel that alarm. Check once.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜