【问题标题】:Android Retrieving current locationAndroid 检索当前位置
【发布时间】:2013-12-03 11:59:23
【问题描述】:

喂。
我是 Android 新手,我想创建一个需要用户当前位置的应用程序。我想知道我应该使用哪个 API,特别是:android.location 中的平台位置 API 或 Google 位置服务 API,它是 Google Play 服务的一部分 - http://developer.android.com/guide/topics/location/strategies.html。基本上我想知道大多数设备是否支持较新的 API。
提前谢谢你。

【问题讨论】:

    标签: android location


    【解决方案1】:

    是的,所有具有最新 Google play services installed 的设备都可以使用新的 API。

    据来源,新的 API (Fused Location Provider) 消耗的电池量非常少,并且如果与意图服务一起使用,即使用户没有使用,也会立即将位置变化通知我们的应用程序在我们的应用中。

    您可以在最新的 android sdk 中获得一个名为 LocationUpdates 的示例。

    更多信息,您可以通过以下链接:

    https://developer.android.com/google/play-services/location.html

    http://www.kpbird.com/2013/06/fused-location-provider-example.html

    https://developer.android.com/training/location/retrieve-current.html

    Fused Location Provider in Android

    【讨论】:

    • 所以基本上大多数设备都会有最新的Google play服务?正如我所说,我对 Android 真的很陌生...
    • @scarlethohara ya 大多数设备都会安装它,因为谷歌已经将他的许多功能固定在它周围。但不知道有些用户可能会卸载应用程序或更新以保持 CPU 使用率..
    • @scarlethohara 如果您觉得我的回答已经解释了您的问题,请接受它..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    相关资源
    最近更新 更多