1

I have created Sqlite database using

var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
pathToDatabase = Path.Combine(documents, databaseName);

using (var conn= new SQLite.SQLiteConnection(pathToDatabase))
{
            conn.CreateTable<SETTINGS> ();
            conn.CreateTable<USER> (); 
}

I want to see(using Sqlite Browser) the database created. How to access the database? I have tried through Xamarin Studio -> Tools -> Android Device Monitor. There is nothing like /data/data/app/databases/test.db

data folder doesn't show any contents. However, i am sure that the database is created as i can query and retrieve the data.

2
  • Are you trying this on an emulator or on an actual device? Commented Oct 18, 2015 at 13:55
  • On actual device. When i expand data folder from Android Device Monitor, there is nothing in. Commented Oct 19, 2015 at 13:52

3 Answers 3

3

You can't access the database file on an actual device unless it's rooted. That file system access is restricted to prevent people from easily gaining access to the data of your application.

The examples you're seeing that are explaining how to access your database on the file system are assuming you're using an emulator.

Sign up to request clarification or add additional context in comments.

2 Comments

How to validate the database then. Is there a way on android to copy the database to desktop and access it.
The way to validate it is to use an emulator. There are emulators included in the SDK, or you can use third-party options, like Genymotion (genymotion.com/#!).
0

Your database is located at files folder from your app directory (e.g. "/data/data/ProjectName.ProjectName/files")

I suggest you take a look at the following link where you'll find the Monodroid environment variables

2 Comments

Yes thats what is the correct path i have. When i expand data folder from Android Device Monitor, there is nothing in. it doesn't show data/ProjectName.ProjectName/files
As Jared told you, if you are trying on device it must be rooted
0

You can copy the DB file programmatically from device internal path to device Download folder and from there you can access it. For more details you can check by blog post here: http://www.appliedcodelog.com/2017/07/how-to-fetch-android-sqlite-db-file.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.