我正在使用谷歌地图应用程序,我是google地图的新手。我跟踪https://stackoverflow.com/a/34582595/7784663谷歌地图集成,但我无法在Android模拟器中的谷歌地图上显示我当前的位置,它只是向我显示默认地图我看不到我当前的位置。输出看起来像https://lh3.googleusercontent.com/-qW_gAxv8JkM/WON0D1oTpVI/AAAAAAAAAbc/QjRKjvjbewQRzmHOTGvfSTFbvx3he3SKQCL0B/h1920/Screenshot_1491301259.png所以任何人都可以帮助我缩短我的问题。提前致谢。我的代码如下......
public doSomething(item): void{
console.log(item);
item.iconName = 'checkmark-circle';
}
答案 0 :(得分:0)
我不知道您使用的是哪个模拟器,但如果您使用Android Studio的集成模拟器,则可以手动插入“当前”位置进入设备模拟器
Options -> Location -> Lat/Long
答案 1 :(得分:0)
private GoogleMap.OnMyLocationChangeListener myLocationChangeListener = new GoogleMap.OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(Location location) {
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
//Place current location marker
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mGoogleMap.addMarker(markerOptions);
//move map camera
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng,11));
//optionally, stop location updates if only current location is needed
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
}
}
};