【问题标题】:Using PendingIntent() to request location updates when running on an O device在 O 设备上运行时使用 PendingIntent() 请求位置更新
【发布时间】:2017-05-04 19:50:33
【问题描述】:

使用 PendingIntent.getService(...) 是请求位置更新的常用方法。这是否仍可用于在 O 设备上运行的应用以接收后台位置更新?

【问题讨论】:

    标签: android android-location fusedlocationproviderapi android-fusedlocation


    【解决方案1】:

    在调用 [FusedLocationPRviderApi#requestLocationUpdates](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi.html#requestLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location. LocationRequest, android.app.PendingIntent))。

    以 O 为目标的应用应仅使用 PendingIntent.getBroadcast()(并定义 BroadcastReceiver 并在清单中注册)以便在后台继续接收位置更新。这是因为面向 O 的应用是 subject to limits on services started in the background

    面向 O 的应用可以继续使用PendingIntent.getService(),如果它只需要在前台接收位置更新。

    【讨论】:

    猜你喜欢
    • 2015-02-02
    • 2012-12-24
    • 2016-06-25
    • 1970-01-01
    • 2018-01-31
    • 2012-03-06
    • 2019-08-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多