我阅读了Android文档,但我仍然需要更多的说明。PendingIntent到底是什么?
当前回答
未决意图是指向其他应用程序提供执行特定工作的所有许可的意图。当主活动被销毁时,Android操作系统会收回主活动的权限。
其他回答
一个PendingIntent是一个令牌,你给一个外部应用程序(例如NotificationManager, AlarmManager, Home Screen AppWidgetManager,或其他第三方应用程序),它允许外部应用程序使用你的应用程序的权限来执行预定义的代码段。
如果你给了外部应用一个Intent,它会用自己的权限执行你的Intent。但是如果你给了外部应用一个PendingIntent,该应用将使用你的应用权限执行你的Intent。
待定意图是指将在未来某个时间点启动的意图。正常的意图在传递给startActivity(intent)或StartService(intent)时立即启动。
In an easy language, 1. A description of an Intent and Target action to perform. First you have to create an intent and then you have to pass an specific java class which you want to execute, to the Intent. 2. You can call those java class which is your class action class by PendingIntent.getActivity, PendingIntent.getActivities(Context, int, Intent[], int), PendingIntent.getBroadcast(Context, int, Intent, int), and PendingIntent.getService(Context, int, Intent, int); Here you see that Intent which is comes from the step 1 3. You should keep in mind that...By giving a PendingIntent to another application, you are granting it the right to perform the operation you have specified.
这是我读了很长时间后学到的。
顾名思义…PendingIntent
你可以过一段时间再做。这是另一个意图。它是一种将你的任务交给其他应用程序来执行的方式。
悬而未决的意图
暂挂意图是对常规意图的包装 供另一个应用程序使用。 它使其他应用程序能够执行包含的功能 行动,因为它是你的应用程序与所有的权限 申请已获批准
当你想打开一些应用程序组件,如活动/服务/BroadcastReceiver在以后的时间或指定的时间间隔后,你必须发送PendingIntent在这种情况下。它就像你给其他应用程序一段时间后代表你运行你的应用程序代码的许可条。因此,PendingIntent可以超越进程边界,比如你想要AlarmManager,这是另一个进程中的另一个应用程序,然后AlarmManager在你的应用程序上执行由PendingIntent指定的操作
推荐文章
- 从资产中读取文件
- 在不活动的地方调用getLayoutInflater()
- 设置Android布局元素的背景颜色
- 错误:'keytool'不能被识别为内部或外部命令、可操作程序或批处理文件
- 在应用程序本身中更改Locale
- apk (.apk)和应用程序包(.aab)的区别
- 如何设置超时在改造库?
- Android - SPAN_EXCLUSIVE_EXCLUSIVE跨度不能为零长度
- TextView的字体大小在Android应用程序改变字体大小从本机设置
- 如何模拟Android杀死我的进程
- 禁用EditText闪烁光标
- Android Eclipse -无法找到*.apk
- 设置TextView文本从html格式的字符串资源在XML
- 如何允许所有网络连接类型HTTP和HTTPS在Android(9)馅饼?
- Android加载JS包失败