[問題]可以將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