如何从得到的PendingIntent意向 [英] How to get Intent from PendingIntent

查看:116
本文介绍了如何从得到的PendingIntent意向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能获得意图的PendingIntent

下面是该方案:


  1. 我创建一个意图(姑且称之为 myIntent

  2. 我把一些额外的信息和String(称之为 MyInfo的

  3. 创建一个的PendingIntent myPendingIntent )使用 myIntent

  4. 我设置使用报警 AlarmManager myPendingIntent

  5. 在后期使用我得到的PendingIntent的持有 PendingIntent.getBroadcast

  6. 在这一点上我想读 MyInfo的 myIntent 这是 myPendingIntent

这可能吗?通过四处寻找谷歌,我来接近的结论是,这是不可能的。


解决方案

  

这可能吗?


不。 的PendingIntent 是一个只写接口。您可以替换意图,但不能读取。

Can I get the Intent from a PendingIntent?

Here is the scenario:

  1. I create an Intent (let's call it myIntent)
  2. I put some Extra information with a String (call it myInfo)
  3. I create a PendingIntent (myPendingIntent) using myIntent
  4. I set an alarm using the AlarmManager and myPendingIntent
  5. At a later stage I get hold of the PendingIntent using PendingIntent.getBroadcast
  6. At that point I want to read myInfo from myIntent which is in myPendingIntent

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 the Intent, but you cannot read it.

这篇关于如何从得到的PendingIntent意向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆