Fix nexus 9 issue with sqlite
This commit is contained in:
parent
a18413bfdc
commit
6340d66eb7
3 changed files with 9 additions and 3 deletions
|
@ -185,8 +185,9 @@ public class SQLiteAPIImpl implements SQLiteAPI {
|
|||
|
||||
@Override
|
||||
public SQLiteConnection openByAbsolutePath(String path, boolean readOnly) {
|
||||
// fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
|
||||
android.database.sqlite.SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null,
|
||||
readOnly? SQLiteDatabase.OPEN_READONLY : SQLiteDatabase.OPEN_READWRITE);
|
||||
readOnly? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING));
|
||||
if(db == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,9 @@ public class BaseLocationIndexRepository<T extends MapObject> {
|
|||
// close previous db
|
||||
db.close();
|
||||
}
|
||||
db = SQLiteDatabase.openOrCreateDatabase(file, null);
|
||||
// fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
|
||||
db = SQLiteDatabase.openDatabase(file.getPath(), null,
|
||||
SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING| SQLiteDatabase.CREATE_IF_NECESSARY);
|
||||
name = file.getName().substring(0, file.getName().indexOf('.'));
|
||||
if(db.getVersion() != version){
|
||||
db.close();
|
||||
|
|
|
@ -49,7 +49,10 @@ public class HillshadeLayer extends MapTileLayer {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
File tilesDir = app.getAppPath(IndexConstants.TILES_INDEX_DIR);
|
||||
sqliteDb = SQLiteDatabase.openOrCreateDatabase(new File(tilesDir, HILLSHADE_CACHE) , null);
|
||||
// fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs
|
||||
sqliteDb = SQLiteDatabase.openDatabase(new File(tilesDir, HILLSHADE_CACHE).getPath() ,
|
||||
null, SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING
|
||||
| SQLiteDatabase.CREATE_IF_NECESSARY );
|
||||
if(sqliteDb.getVersion() == 0) {
|
||||
sqliteDb.setVersion(1);
|
||||
sqliteDb.execSQL("CREATE TABLE TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)");
|
||||
|
|
Loading…
Reference in a new issue