[Android] PendingIntent详解
Intent是一个意图,一个描述了想要启动一个Activity、Broadcast或是Service的意图。它主要持有的信息是它想要启动的组件(Activity、Broadcast或是Service),在开发操作中,需要通过 startActivity , startService 或sendBroadcast 方法来启动这个意图执行某些操作!! PendingIntent可以认为是对Intent的包装,实际上就是,供当前App或之外的其他App调用,而常见的是供外部App使用,外部App执行这个 PendingIntent时,间接地调用里面的Intent,即外部App延时执行PendingIntent中描述的Intent及其最终行为,PendingIntent主要持有的信息是它所包装的Intent和当前App Context,即使当前App已经不存在了,也能通过存在于PendingIntent里的 Context来执行Intent。当你把PendingIntent递交给别的程序进行处理时,PendingIntent仍然拥有PendingIntent原程序所拥有的权限,当你从系统取得一个PendingIntent时,一定要非常小心才行,比如,通常,如果Intent目的地是你自己的component(Activity/Service/BroadcastReceiver)的话