2016-04-02 4 views
1

アプリケーションID +アプリケーションコード+ライセンスキーを追加したにもかかわらず、このエラーが発生し、マップが表示されません(空白の画面のみ) 私はモバイルSDKプレミアム(試用版)と私は、このexampleここをクリックしてください:SDK:マップフラグメントを初期化できません:OPERATION_NOT_ALLOWED

に続き、ここに私のコード

アンドロイドたManifest.xml

<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.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:hardwareAccelerated="true" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name=".BasicMapActivity" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme.NoActionBar" > 
     <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="{app id}"/> 
    <meta-data android:name="com.here.android.maps.apptoken" 
       android:value="{app code}"/> 
    <meta-data android:name="com.here.android.maps.license.key" 
       android:value="{License key}"/> 

    <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> 

です

BasicMapActivity.java

マニフェストファイルで
public class BasicMapActivity extends Activity { 
// map embedded in the map fragment 
    private Map map = null; 
    // map fragment embedded in this activity 
    private MapFragment mapFragment = null; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_basic_map); 

     // Search for the map fragment to finish setup by calling init(). 
     mapFragment = (MapFragment)getFragmentManager().findFragmentById(
       R.id.mapfragment); 
     mapFragment.init(new OnEngineInitListener() { 
      @Override 
      public void onEngineInitializationCompleted(
        OnEngineInitListener.Error error) 
      { 
       if (error == OnEngineInitListener.Error.NONE) { 
        // retrieve a reference of the map from the map fragment 
        map = mapFragment.getMap(); 
        // Set the map center to the Vancouver region (no animation) 
        map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0), 
          Map.Animation.NONE); 
        // Set the zoom level to the average between min and max 
        map.setZoomLevel(
          (map.getMaxZoomLevel() + map.getMinZoomLevel())/2); 
       } else { 
        System.out.println("ERROR: Cannot initialize Map Fragment: " + error.toString()); 
       } 
      } 
     }); 
    } 
} 

activity_basic_map.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="hello_world" 
     tools:context=".BasicMapActivity" /> 

    <!-- Map Fragment embedded with the map object --> 
    <fragment 
     class="com.here.android.mpa.mapping.MapFragment" 
     android:id="@+id/mapfragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 
</LinearLayout> 
+0

https://stackoverflow.com/questions/36364047/i-got-missing-permission-issue-here-maps-androidの可能な複製はありますか?私がそこに加えた答えを試してください。ありがとう。 – Marco

+0

My TargetSdkVersionは22です@Marco –

+0

あなたのアプリの名前空間はdeveloper.here.comに登録したものと同じですか?ライセンスキーはappid/tokenとapp名前空間をエンコードし、一致する必要があります。また、信任状の末尾および先頭のスペースも調べてください。 – Marco

答えて

0

、アプリケーションタグのうち、サービスタグをつけてみてください。 問題が解決することを願っています。

関連する問題