【问题标题】:LocationClient requestLocationUpdates with PendingIntentLocationClient requestLocationUpdates 与 PendingIntent
【发布时间】:2013-06-04 23:10:31
【问题描述】:

我正在尝试实施此处解释的流程:https://developer.android.com/training/location/receive-location-updates.html

我想使用 requestLocationUpdates() 方法的 PendingIntent 变体,这在前面的课程中没有解释。

我遇到了两个问题:
- 当我收到意图时,它似乎没有可用的附加功能。此外,没有像地理围栏 (getTriggeringGeofences) 或活动 (extractResult) 这样的辅助函数。我是否需要再次连接到 Location Client 并获取最后一个位置 onConnect?在 IntentService 中使用它不会有问题吗?
- 无论我指定什么时间间隔,我只会将一个即时意图发送到我的 IntentService,而不会发送其他意图。这不是完全支持吗?

提前致谢。

【问题讨论】:

  • 贴出你正在使用的代码

标签: android android-intent location android-pendingintent intentservice


【解决方案1】:

文档解释了PendingIntent 如何发送here。以下是重要的部分:

如果调用者提供了一个待处理的意图,那么位置更新是 使用 KEY_LOCATION_CHANGED 键和 Location 值发送。

这意味着当发送PendingIntent 时,应该有一个额外的密钥LocationManager.KEY_LOCATION_CHANGED。这个额外的作为 Location 对象。

【讨论】:

  • @cja 抱歉,是什么让您认为这个问题指的是融合的位置提供程序?我在问题中看不到任何迹象。
  • 标题中提到了LocationClient
  • @cja 好的,谢谢。无论如何,OP 没有回复我的评论或其他任何内容。所以显然这不是他的首要任务。
  • 但对其他人有用@DavidWasser 感谢您的回答
猜你喜欢
  • 1970-01-01
  • 2013-05-21
  • 1970-01-01
  • 2013-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-10
相关资源
最近更新 更多