【问题标题】:Why do we use a pendingIntent to start a GeofenceTransitionIntentService?为什么我们使用一个pendingIntent来启动一个GeofenceTransitionIntentService?
【发布时间】:2015-09-30 20:56:32
【问题描述】:

我正在浏览有关地理围栏的 google 文档,但我有一些疑问。他们使用了一个pendingIntent 来启动GeofenceTransitionIntentService。有人可以解释为什么吗?还有什么时候会触发pendingIntent?是在用户输入地理围栏时完成还是在创建 pendingIntent 时完成。提前致谢!!

从android docs和我对pendingIntent的一点了解我无法理解这里的外国应用程序是什么?

PendingIntent 是您提供给外部应用程序的令牌 (例如 NotificationManager 、 AlarmManager 、主屏幕 AppWidgetManager 或其他 3rd 方应用程序),它允许 外部应用程序使用您的应用程序的权限来执行 预定义的一段代码。

Geofencing Docs

【问题讨论】:

    标签: android android-pendingintent android-geofence


    【解决方案1】:

    待处理的意图不是即时的,这就是为什么它被称为待处理的原因。就像在本段中一样。

    PendingIntent 是您提供给外部应用程序(例如 NotificationManager 、 AlarmManager 、主屏幕 AppWidgetManager 或其他 3rd 方应用程序)的令牌,它允许外部应用程序使用您的应用程序的权限来执行预定义的一段代码。

    以 NotificationManager 为例,它是一个外部服务或应用程序。当使用NotificationManager 类创建Notification 时,您传递了一个链接到活动(或只是说应用程序)的PendingIntent,这就是处理通知的意图。它只是说pendingIntent 将链接到单击时将处理通知的应用程序。

    地理围栏也是如此,pendingIntent 处于未决状态(等待)直到触发其调用将执行传入事件或数据等的应用程序的操作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-27
      • 2011-02-22
      • 1970-01-01
      • 2015-03-28
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      • 2017-08-25
      相关资源
      最近更新 更多