什么是 Android PendingIntent? [英] What is an Android PendingIntent?
问题描述
我是 Android 的新手.我阅读了 Android 文档,但我仍然需要更多说明.谁能告诉我 PendingIntent
到底是什么?
I am a newbie to Android. I read the Android Documentation but I still need some more clarification. Can anyone tell me what exactly a PendingIntent
is?
推荐答案
A PendingIntent
是您提供给外部应用程序的令牌(例如 NotificationManager
、AlarmManager
、主屏幕 AppWidgetManager
或其他 3rd 方应用程序),它允许外部应用程序使用您应用程序的权限来执行一段预定义的代码.
A PendingIntent
is a token that you give to a foreign application (e.g. NotificationManager
, AlarmManager
, Home Screen AppWidgetManager
, or other 3rd party applications), which allows the foreign application to use your application's permissions to execute a predefined piece of code.
如果你给外部应用一个 Intent,它会用它自己的权限执行你的 Intent
.但是,如果您给外部应用程序一个 PendingIntent
,该应用程序将使用您的应用程序的权限执行您的 Intent
.
If you give the foreign application an Intent, it will execute your Intent
with its own permissions. But if you give the foreign application a PendingIntent
, that application will execute your Intent
using your application's permission.
这篇关于什么是 Android PendingIntent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!