我应该如何初始化SKMapInitSettings的路径?

时间:2014-05-29 14:18:30

标签: android skmaps

我正在尝试为Android设置Skobbler Maps SDK,但我无法初始化它。我无法在文档中找到我应该在'SKMapInitSettings'上设置的路径值。我得到以下异常:

05-29 16:09:29.713: E/AndroidRuntime(18545):
com.skobbler.ngx.SKMapsPathsNotInitializedException: SKMaps paths were not
initialized. Set the following in SKMapInitSettings : mapResourcesPath,
currentMapViewStyle, mapsPath.

这些路径的适当值是什么?为什么不默认设置?

1 个答案:

答案 0 :(得分:4)

Android demo project中有一个关于如何设置路径的示例:

    SKMapsInitSettings initMapSettings = new SKMapsInitSettings();
    // set path to map resources and initial map style
    initMapSettings.setMapResourcesPaths(app.getMapResourcesDirPath(),
            new SKMapViewStyle(app.getMapResourcesDirPath() + "daystyle/", "daystyle.json"));

app.getMapResourcesDirPath指向的地方:

    File externalDir = getExternalFilesDir(null);

    // determine path where map resources should be copied on the device
    if (externalDir != null) {
        mapResourcesDirPath = externalDir + "/" + "SKMaps/";
    } else {
        mapResourcesDirPath = getFilesDir() + "/" + "SKMaps/";
    }
    ((DemoApplication) getApplication()).setMapResourcesDirPath(mapResourcesDirPath);