android.app.PendingIntent

By giving a PendingIntent to another application, you are granting it the right to

perform the operation you have specified as if the other application was yourself (with the same permissions and identity). As such, you should be careful about how you

build the PendingIntent: often, for example, the base Intent you supply will have the component name explicitly set to one of your own components, to ensure it is ultimately sent there and nowhere else.

A PendingIntent itself is simply a reference to a token maintained by the system describing the original data used to retrieve it. This means that, even if its owning application's process is killed, the PendingIntent itself will remain usable from other processes that have been given it. If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call cancel() to remove it.

Summary

翻译如下:

通过给另外一个应用程序一个PendingIntent,你授予了它你指定的正确的操作过程,就像这个应用程序是你自己的一样(拥有相同的权限和身份认证)。因此,你应该认真地考虑如何构建这个PendingIntent对象:通常状况下,例如,这个你提供的基本的Intent应该拥有的这些组件名称明确地设置给你自己的组件之一,通过这样来确保它最终被发送并且没有其他地方存在。

一个PendingIntent对象仅仅是一个参考,它被系统维护,描述为通常被检索的原始数据。如果之后又创建一个应用程序,再次检索同样的PendingIntent(拥有同样的操作,同样的Intent动作、数据、类别、组件及相同的标志),它将接收到一个PendingIntent代表同样的指令,如果它仍有效,并且可以因此调用cancel()方法去清除掉它 。

更多相关文章

  1. Android(安卓)UI界面之TableLayout
  2. 如何创建一个安卓项目
  3. android改变按下和放开组件时字体的颜色
  4. Android应用程序生命周期
  5. android实习程序
  6. Android(安卓)Studio入门小例子
  7. Intents and Intent Filters
  8. Marshmallow and User Data
  9. Android(安卓)ConstraintLayout完全解析

随机推荐

  1. Android使用WebView来显示天气预报
  2. Android(安卓)Media Scanner Mechanism A
  3. Android(安卓)Context相关总结
  4. Android(安卓)下载 断点续传
  5. android 混淆
  6. Android(安卓)Contacts(一)—— 读取联系人
  7. Programmatically Injecting Events on A
  8. Android(安卓)编程 技巧
  9. Android中下载文件的使用
  10. Android横屏竖屏切换的问题