Asynstorage not working on android 7+ as i expected.
try {
const value = await AsyncStorage.getItem('@history');
if (value !== null) {
this.setState({ history: JSON.parse(value) })
}
} catch (e) {
// error reading value
}
this is the code.. but the promise return nothing..
it's workig below Anroid 7..
please help me to solve it.. Thanks
@Waqas-Jani what do you mean promise return nothing?
empty .. (nothing to show ) in android 7+
but working proper below android 7 ..
setItem:
await AsyncStorage.setItem('@history', JSON.stringify(history));
getItem:
try {
const value = await AsyncStorage.getItem('@history');
if (value !== null) {
this.setState({ history: JSON.parse(value) })
}
} catch (e) {
// error reading value
}
screen short:: Android 6

Android 7
Anyone has solution ????
Have you tried to debug/console.log the value you get from getItem?
it's release apk file
any solution ???
@Waqas-Jani You'd have to debug it. Run dev build and see what might cause this issue. From your snippet, it seems like you're not handling the situation where getItems returns null - nothing is saved yet.
it's working on . android 6 ,save data and getting .. but not on android 7.. , not save and get
i checked it . on android 9 and there also not working
in docs. there is nothing to demostration for handling . android version level ..
How about debugging it? Have you checked the logcat output?
yes.. get value in android 6 but not above on android 6. it's null
generate apk file.. same result
@Krizzu I can confirm that this is still happening. I tested it today using Genymotion - it works well on Android 6 and 8 but fails on Android 7 and 9. Tested it also on "real" devices, Android 6 and 8 and it works. Our client "tested it" today on Android 7 and we had a bug fix to do (really a hack fix, just overriding AsyncStorage on Android 7 and 9, which is not a solution).
@filiphosko So you say you receive null every time you call getItem on Android 7/9?
Can you do a simple test of saving and then reading a saved value?
@filiphosko yes it's happening , plz solve it
@Krizzu It didn't return null, it just didn't resolve/reject the promise - no errors (tested on getItem and setItem). Since we found out about this problem during the UAT tests, we needed to deploy a quick fix, so we just skipped the calls to AsyncStorage on Nougat and Pie, like this:
import {Platform} from 'react-native';
const isDroid = Platform.OS === 'android';
const isNougat = isDroid && (Platform.Version >= 24 && Platform.Version < 26);
const isPie = isDroid && Platform.Version >= 28;
export default function isAsyncStorageSafe() {
if (isNougat || isPie) {
return false;
}
return true;
}
This helped immediately - tested with Genymotion emulator on devices with Nougat and Pie. We deployed the fix and it worked also on the device of our customer (with Nougat installed).
BUT - I tested it today to debug it further, removed the calls to isAsyncStorageSafe... and everything worked. On devices with Nougat and Pie, where it failed yesterday. I checked the commits and really the only difference was that we added this method. So right now I'm clueless, but I'm not confident enough to remove it from the production app.
@filiphosko Thanks for your input. Indeed strange case.
Some devs have reported not-resolving promises returning from AsyncStorage. It had to do with shared thread pool Async Storage was using, which on several devices was causing the clog.
Solved it by adding a dedicated executor feature. Maybe this could help.
is it soloved ..??? @Krizzu
@Krizzu thanks for the hint, I'll try it
@filiphosko @Waqas-Jani did it help?
@filiphosko i'll try. thanks for it
@Waqas-Jani any update?
@Krizzu yet, i don't test on android 7. when i'll test then tell you,
might be same issue as in #219
it's working now. @Krizzu thanks