Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

reactjs - Where is AsyncStorage Data Physically Located on Android Devices?

Maybe the title isn't very clear. Here is what I mean/need to know-

If I use SQLite for some data storing purpose on Android app, I can see the DB created in my phone. (/root/data or something I guess). I have viewed the DB and performed some manipulations, it helps in development.

Now, I am using AsyncStorage API of react native. There is some problem in my code, I am not able to get the stored data from the store. Not sure what I am doing wrong.

So, to see what's wrong, is there a way to view the list of Objects that are being stored on the phone? If so where? And how do I view it?

PS: I am debugging my React Native app using Android Studio's logs. As my chrome on linux is a bad boy(Any Help would be appreciated)!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can follow below steps

  1. Run your apk in debug mode in your device and connect your device to your system

  2. Open command prompt.

  3. To get list of databases related to your application use below command

adb -d shell "run-as om.yourpackage_name ls /data/data/com.yourpackage_name/databases/

you can get package name from your AndroidManifest.xml file

  1. Now you have database name in above list then copy that database to sdcard in your phone using following command for react native it will be RKStorage

adb -d shell "run-as com.yourpackage cp /data/data/com.your_package/databases/RKStorage /sdcard/Rkstorage"

  1. Now use below command to pull above copied database from your device to your system. below command will copy database to directory where adb.exe exists.

adb pull /sdcard/Rkstorage

  1. Now Install Firefox SQLite Manager: https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/

  2. Open Firefox SQLite Manager from Tools->SQLite Manager

  3. In SQLite Manager go to Database->Connect Database and "open file" window will open there you select All files at bottom of your window and navigate where your database copied.

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...