[问题]可以将pendingIntent传递给另一个App嘛?

楼主: lin791126 (E猪)   2016-01-27 17:06:54
小弟最近在自学练习Android studio,在PendingIntend 这边遇到一些瓶颈,
上网查资料还是有遇到一些技术上的困难,来到这边恳请先辈解惑,
关于PendingIntent 我在网络上找到的一段话:
PendingIntent is basically an object that wraps another Intent object.
Then it can be passed to a foreign application where you’re granting that
app the right to perform the operation,
i.e., execute the intent as if it were executed from your own app’s process
(same permission and identity).
For security reasons you should always pass explicit intents to a
PendingIntent rather than being implicit.
我的理解是PendingIntent 就是一个把原本Intent包装好后,
送去给其他的foreign application,
不论原本的app开关与否,其都会等待时机执行。
网络上书上都会教你作 Notification 、 alarm manager 等service练习,
这些我都实作会了,
但现在问题来了,扣除以上的例子,该如何实作跨App 的pendingIntent?
比如说,我有3个各自独立的App A B C,
今天有没有方法我在A App 宣告一个可以开启C App的Intent
(可能用implicit Intend)
然后用 pendingIntent 包装 送至 B App,
最后在 B App 在满足一定条件后,在启动C App 嘛?
找资料找了一阵子,没有好的解答,希冀能在这边得到解答,
小弟愿付上300P币感谢解答! 感谢不尽!
作者: ssccg (23)   2016-01-27 18:22:00
PendingIntent是Parcelable,所以可以放到intent extra传
作者: charlesdc (MoOn)   2016-01-28 00:20:00
去看看widget的写法你会更容易了解
楼主: lin791126 (E猪)   2016-01-29 11:11:00
呜呜 感谢两位 P币一人300 已送出

Links booklink

Contact Us: admin [ a t ] ucptt.com