【问题标题】:Android: Does context affect filterEquals(), used to cancel alarm?Android:上下文是否影响用于取消警报的filterEquals()?
【发布时间】:2012-12-09 11:33:55
【问题描述】:

要取消闹钟,我使用alarmManager.cancel(pendingIntent);,据android 开发人员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 个使用不同上下文构造的 pendingIntent,并且它们使用的 Intent 也具有不同的上下文,但它们引用的类相同,那么 filterEquals(Intent) 是否返回 true?

所以,pendingIntent1 有:context1 和一个带有 context1 和 class1.class 的意图

而 pendingIntent2 有:context2 和一个带有 context2 和 class1.class 的意图

提前致谢!

【问题讨论】:

    标签: java android android-intent alarmmanager android-pendingintent


    【解决方案1】:

    我认为它们应该是一样的。根据this,只需要上下文来检索你的应用程序的包名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多