Closed flamed0011 closed 9 years ago
Are you trying to run on an Android emulator or device? Unfortunately I don't have an Android device to test with and none of the emulators I've tried support WebGL inside the Cordova Webview. I have managed to do some testing when I've had access to devices and thought this should work on Android 5, but unfortunately I don't have regular access to a device for testing.
These links might help:
Android-specific options for SQLite Plugin: https://github.com/litehelpers/Cordova-sqlite-storage#android-sqlite-implementation
Where sqlitePlugin.openDatabase is called: https://github.com/trevorpowell/mapbox-gl-js-cordova-offline/blob/cordova-offline/js/source/vector_tile_source.js#L88
One solution to get it running on an Android emulator is to use the Cordova Crosswalk plugin. Then you can add a Crosswalk flag to force WebGL to be enabled in the app on the emulator: https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview https://github.com/litehelpers/Cordova-sqlite-storage/issues/247
I'm testing on a device running Android 5.1.1 (Cyanogenmod 12.1). The links you provided helped to find the solution. Thanks alot.
I modified mapgbox-gl.js directly in the minified version (searched for window.sqlitePlugin.openDatabase and added the "androidDatabaseImplementation: 2" parameter. This is described in the first of your links:
window.sqlitePlugin.openDatabase({
name:t.source+".mbtiles",
location:2,
createFromLocation:1,
androidDatabaseImplementation: 2
})
Before I tried several other things. Just for documentation:
cordova-plugin-crosswalk-webview,cordova-plugin-splashscreen,cordova-plugin-whitelist,io.litehelpers.cordova.sqlite
The app works nicely. I'm hoping to have some time to play with tilemaker.
Hi, just wanted to try your great example app. The app crashes with the logcat output as pasted below. The error "JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0x8b" seems to be thrown when execting the query "SELECT tile_data FROM tiles WHERE zoom_level = ? AND tile_column = ? AND tile_row = ?".