mardi 24 novembre 2015

Path to store SQLite database in Xamarin Android

I'm trying to store a local SQLite database in the internal storage of the device. When I was using an emulator , this:

static string dbName = "totems.sqlite";
string dbPath = Path.Combine (Android.OS.Environment.ExternalStorageDirectory.ToString (), dbName);

worked fine. But when I tried to debug on my Nexus 5, it didn't work, because it doesn't have external storage. I searched where to store it so it could run on my Nexus as well. I replaced it with:

static string dbName = "totems.sqlite";
string dbPath = Path.Combine ("/data/data/com.companyname.totem/databases/", dbName);

But now it doesn't work on my Nexus 5 and it doesn't work on my emulator. It says it can't find the path.

What am I doing wrong?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire