Android: Does context affect filterEquals(), used to cancel alarm?

落爺英雄遲暮 提交于 2019-12-30 11:48:27

问题


To cancel an alarm, I use alarmManager.cancel(pendingIntent); which, according to android developers 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.

If it compares 2 pendingIntents which are constructed with a different context and the intents they use have a different context as well, but the classes they refer to are the same, does filterEquals(Intent) return true?

So, pendingIntent1 has: context1 and an intent with context1 and class1.class

And pendingIntent2 has: context2 and an intent with context2 and class1.class

Thanks in advance!


回答1:


I think they should be the same. According to this, the context is only needed to retrieve the package name of your application.



来源:https://stackoverflow.com/questions/13787006/android-does-context-affect-filterequals-used-to-cancel-alarm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!