I have a list view in my app, some data is saving to the database before populating list view.
My problem is that can't see the data, and how to verify the data is stored in the database.
I have a list view in my app, some data is saving to the database before populating list view.
My problem is that can't see the data, and how to verify the data is stored in the database.
I am giving the solution for Visual Studio 2015 (worked for Xamarin).
You can use use a SQLite browser, such as the open-source multi-platform DB Browser for SQLite, or another tool of your choice.
Getting access to the sqlite file is the next thing:
iOS Simulator:
/Users/administrator/Library/Application Support/iPhone Simulator
You can browse simulator files from that directory in Mac OS X.
Android Emulator:
You can use the command line via adb shell
command for browsing file system:
ls - list current directory
cd - change current directory
Once you find the Sqlite file for your app, you can use the pull
cmd for copying the file from device (or emulator image):
adb pull /sdcard/file.txt file.txt
adb
in some way, no way around it, Genymotion packages a specific version or your can use the latest one from Google : genymotion.com/#!/support?chapter=adb-connection –
Guenna I solved this problem in a few steps:
On Windows:
Download a SQLite viewer, for example SQLiteStudio.
Find where the .db or .db3 file is stored, i did it this way:
var databasePath = Path.Combine(FileSystem.AppDataDirectory, "localDB.db3");
Console.WriteLine(databasePath);
For me the path was: /data/user/0/com.companyname.[name]/files/localDB.db3
Find where the Android Debug Bridge (adb) .exe is stored. For me it was stored at: C:\Users[user]\AppData\Local\Android\Sdk\platform-tools. (AppData is a hidden folder, so make sure that hidden folders are visible.
Open a command prompt at this folder.
Try to copy the database file to a local folder on your machine by entering the following line into the command prompt:
adb pull [path to database] [path to local folder]
results in:
adb pull /data/user/0/com.companyname.[name]/files/localDB.db3 C:\Users\[user]\Desktop
adb root
Try to copy the file again.
If the file is succesfully copied, open it with SQLiteStudio.
et voila
Here is how you can access the sqlite database file in xamarin forms using Rider IDE:
private string GetDatabasePath()
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "db.db");
}
Logging Environment.GetFolderPath(Environment.SpecialFolder.Personal)
prints this path on my device
/data/user/0/com.companyname.landpriceexplorer/files
Double click the file to add to the data source.
Open the Database tab and browse your data there.
For Visual Studio 2022 I have created extension which gives posibility to read sqlite database. It works on xamarin and maui applications.
https://marketplace.visualstudio.com/items?itemName=BinaryAlchemist.AndroidSqliteLiveReader
Because of permissions this extension works only on emulators and with applications created in debug mode.
User needs to provide a path to the folder where Android Debug Bridge. Select running device and manually input or browse path where database is located.
After clicking get data, extension will download database from the device and load it to grid view
© 2022 - 2025 — McMap. All rights reserved.