如何从得到的PendingIntent意向 [英] How to get Intent from PendingIntent
本文介绍了如何从得到的PendingIntent意向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我能获得意图
从的PendingIntent
?
下面是该方案:
- 我创建一个
意图
(姑且称之为myIntent
) - 我把一些额外的信息和String(称之为
MyInfo的
) - 创建一个
的PendingIntent
(myPendingIntent
)使用myIntent
- 我设置使用报警
AlarmManager
和myPendingIntent
- 在后期使用我得到的PendingIntent的持有
PendingIntent.getBroadcast
- 在这一点上我想读
MyInfo的
从myIntent
这是myPendingIntent
这可能吗?通过四处寻找谷歌,我来接近的结论是,这是不可能的。
解决方案
这可能吗?
块引用>不。
的PendingIntent
是一个只写接口。您可以替换意图
,但不能读取。Can I get the
Intent
from aPendingIntent
?Here is the scenario:
- I create an
Intent
(let's call itmyIntent
)- I put some Extra information with a String (call it
myInfo
)- I create a
PendingIntent
(myPendingIntent
) usingmyIntent
- I set an alarm using the
AlarmManager
andmyPendingIntent
- At a later stage I get hold of the PendingIntent using
PendingIntent.getBroadcast
- At that point I want to read
myInfo
frommyIntent
which is inmyPendingIntent
Is this possible? By looking around Google, I am coming close to the conclusion that this is not possible.
解决方案Is this possible?
Nope.
PendingIntent
is a write-only interface. You can replace theIntent
, but you cannot read it.这篇关于如何从得到的PendingIntent意向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文