我有这个代码
LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
UtilsDialog.displayPromptForEnablingGPS(MainActivity.this);
}
SmartLocation.with(getApplicationContext()).location()
.oneFix()
.start(new OnLocationUpdatedListener() {
@Override
public void onLocationUpdated(Location location) {
double Lat = location.getLatitude();
double Lng = location.getLongitude();
LatLng coordinate = new LatLng(Lat, Lng);
mMap.addMarker(new MarkerOptions().position(coordinate).title("you are here").icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_map_pin)));
CameraUpdate yourLocation = CameraUpdateFactory.newLatLng(coordinate);
mMap.animateCamera(yourLocation);
mMap.clear();
}
});
我已经检查了不同版本的代码,但是在Android8版本中不能工作,并且我使用了SmartLocation库,我如何解决这个问题?
发布于 2018-01-22 08:38:31
我通过在设备的开发者选项中启用模拟位置应用程序解决了这个问题
这是模拟定位应用
https://stackoverflow.com/questions/48376964
复制相似问题