It seems that it\'s possible access the AsyncStorage
from Android (native); but I still struggling to make this work.
In my React Native application, I
I had a problem with alarm clock in my application and I decided to use AsyncStorage on Android side, then I use the code below and I could get all values from AsyncStorage and generate all alarms that was registered in my application's AsyncStorage.
SQLiteDatabase readableDatabase = null;
readableDatabase = ReactDatabaseSupplier.getInstance(this.reactContext).getReadableDatabase();
Cursor catalystLocalStorage = readableDatabase.query("catalystLocalStorage", null, null, null, null, null, null);
try {
List listaAlarmes = new ArrayList<>();
if (catalystLocalStorage.moveToFirst()) {
do {
//Ex: key: 01082019_0800
//value: [{executionDate: 2019-08-01T08:00}]
String key = catalystLocalStorage.getString(0);
String json = catalystLocalStorage.getString(1);
if (dados.length == 3) {
...generate my alarms with key and json
}
} while (catalystLocalStorage.moveToNext());
}//2_31082019_0900 - [{"idPrescricaoMedicamento":35,"nomeMedicamento":"VITAMINA"}]
} finally {
if (catalystLocalStorage != null) {
catalystLocalStorage.close();
}
if (readableDatabase != null) {
readableDatabase.close();
}
}