0

in my app i download a sqlite db on device. The first step of app is download the DB, but on Android 6.0 the app sak permission. If user deny permission the download are not stored on app and i have this error:

android.database.sqlite.SQLiteException: no such table

on this line of my code because there isn't table on db:

public List<String> getAllComuneName() {
    List<String> result = new ArrayList<String>();  
    String[] colums = new String[]{database_comune_schema._NOME};
    Cursor cursor = mDb.query(database_comune_schema.TABLE_NAME, colums, null, null, null, null, null);
    if (cursor != null) {
        while (cursor.moveToNext()) {
            result.add(cursor.getString(cursor.getColumnIndex(database_comune_schema._NOME)));
        }
        cursor.close();
    }
    return result;
}

how i can ivode that app crash if user deny premission in this case?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
APPGIS
  • 353
  • 1
  • 10
  • 20
  • Check for the permission before you attempt to connect to the DB and if they don't have it show a dialog that explains why they need it for the functionality and ask them for permission again. – zgc7009 Oct 31 '16 at 19:25
  • don't use the database if it does not exist. – njzk2 Oct 31 '16 at 19:26

0 Answers0