현재 위치 관리자, getlocation() 메소드에서 현재 사용자 위치를 얻으려는 여기지도는 새로 왔지만 코드는 항상 반환됩니다. 아래 내용Android :지도 위치 지정 관리자 getposition() 항상 Lat : 17976931348623200 .., Lon : 17976931348623200
com.nokia.maps.GeoPositionImpl [좌표 정보 좌표 = [위도 경도 = -179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000 = -1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000 고도 = 1073741824.000000 유효한 = FALSE가] 다음은
내 코드입니다 : protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//requestPermissions();
// Search for the Map Fragment
final MapFragment mapFragment = (MapFragment)
getFragmentManager().findFragmentById(R.id.mapfragment);
// initialize the Map Fragment and
// retrieve the map that is associated to the fragment
mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(
OnEngineInitListener.Error error) {
if (error == OnEngineInitListener.Error.NONE) {
// now the map is ready to be used
map = mapFragment.getMap();
onMapFragmentInitializationCompleted();
} else {
System.out.println("ERROR: Cannot initialize MapFragment");
System.out.println("ERROR: Cannot initialize Map Fragment: " + error.toString());
}
}
});
}
private void onMapFragmentInitializationCompleted() {
PositioningManager posManager;
MapContainer placesContainer = null;
// retrieve a reference of the map from the map fragment
// map = mapFragment.getMap();
// start the position manager
posManager = PositioningManager.getInstance();
posManager.start(PositioningManager.LocationMethod.GPS_NETWORK);
GeoPosition position = posManager.getPosition();
GeoCoordinate cor = position.getCoordinate();
// Set a pedestrian friendly map scheme
map.setMapScheme(Map.Scheme.PEDESTRIAN_DAY);
// Display position indicator
map.getPositionIndicator().setVisible(true);
placesContainer = new MapContainer();
map.addMapObject(placesContainer);
// Set the map center coordinate to the current position
map.setCenter(posManager.getPosition().getCoordinate(), Map.Animation.NONE);
map.setZoomLevel(14);
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.benz.event.navigation">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="navigation"
android:hardwareAccelerated="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.here.android.maps.appid" android:value="MY ID"/>
<meta-data android:name="com.here.android.maps.apptoken" android:value="MY TOKEN"/>
<meta-data android:name="com.here.android.maps.license.key" android:value="MY KEY"/>
<!--
Embed the HERE Map Service.
For more information, see the HERE SDK Developer's Guide
-->
<service
android:name="com.here.android.mpa.service.MapService"
android:label="HereMapService"
android:process="global.Here.Map.Service.v2"
android:exported="true" >
<intent-filter>
<action android:name="com.here.android.mpa.service.MapService" >
</action>
</intent-filter>
</service>
</application>
</manifest>
어떤 도움/힌트 내 하루가 저장됩니다
감사
답장을 보내 주셔서 감사합니다. 결과가 실내 및 실외 시나리오와 동일합니다 (Google 앱의 위치가 예상대로 작동하므로 장치 문제가 아닐 수도 있음). 이미 필요한 권한이 추가되었습니다. 내 매니페스트, 여전히 운이 없음 – Khan
응용 프로그램을 빌드하는 SDK 대상은 무엇입니까? 귀하의 코드 스 니펫에서 requestPermissions()가 주석 처리 된 것을 볼 수 있습니다. 이는 앱이 이전 권한 모델을 사용하고 있음을 의미합니까? –
세부 사항 : Complied 버전 : compileSdkVersion 25 :: buildToolsVersion "25.0.0":: minSdkVersion 15 :: targetSdkVersion 22, 현재 Android 5.0.2 API 21이 포함 된 Asus p01z 타블렛을 사용하고 있습니다. – Khan