安卓:有没有背景影响filterEquals(),用于取消报警?(Android: Does con

2019-07-04 19:47发布

要取消闹铃,我用alarmManager.cancel(pendingIntent); 其中,根据机器人的开发Removes any alarms with a matching Intent. Any alarm, of any type, whose Intent matches this one (as defined by filterEquals(Intent)), will be canceled. Removes any alarms with a matching Intent. Any alarm, of any type, whose Intent matches this one (as defined by filterEquals(Intent)), will be canceled.

如果比较这些构造与不同的环境和他们使用有不同的背景,以及对意图2个pendingIntents,但他们班指的是相同的,不filterEquals(意向)返回true?

因此,pendingIntent1有:CONTEXT1与CONTEXT1和class1.class意图

而pendingIntent2有:上下文2与上下文2和class1.class意图

提前致谢!

Answer 1:

我想他们应该是相同的。 根据此 ,上下文只需要检索应用程序的包名。



文章来源: Android: Does context affect filterEquals(), used to cancel alarm?