繁体   English   中英

在没有谷歌播放服务的情况下获取用户位置在 android 设备上不起作用

[英]get user location not working on android devices without google play services

我遇到了华为设备和所有没有谷歌播放服务的设备的问题如果我想从这些设备获取用户位置,我该怎么办?

您可以将 LocationManager 与 GPS 或 .NETWORK 提供商一起使用。

LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE);

Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

参考: 在没有谷歌播放服务的情况下获取位置-android

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM