Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sqlite Xamarin Android-在哪里存储本地数据库,以便我可以查看它_Sqlite_Xamarin_Xamarin.android_Xamarin.forms - Fatal编程技术网

Sqlite Xamarin Android-在哪里存储本地数据库,以便我可以查看它

Sqlite Xamarin Android-在哪里存储本地数据库,以便我可以查看它,sqlite,xamarin,xamarin.android,xamarin.forms,Sqlite,Xamarin,Xamarin.android,Xamarin.forms,我目前正在使用此代码将本地sqlite数据库保存在Environment.GetFolderPath(Environment.SpecialFolder.Personal)中 现在我正试图把数据库复制到我的电脑上,这样我就可以看到里面有什么了。但是我无法看到这个文件夹,除非它是根目录 保存数据库的最佳位置在哪里,以便我可以不时查看 以下是我的android DB代码: [assembly: Dependency(typeof(SQLite_Android))] namespace AppNam

我目前正在使用此代码将本地sqlite数据库保存在
Environment.GetFolderPath(Environment.SpecialFolder.Personal)

现在我正试图把数据库复制到我的电脑上,这样我就可以看到里面有什么了。但是我无法看到这个文件夹,除非它是根目录

保存数据库的最佳位置在哪里,以便我可以不时查看

以下是我的android DB代码:

[assembly: Dependency(typeof(SQLite_Android))]

namespace AppName.Droid
{
    public class SQLite_Android : ILocalDb.Interfaces.ILocalDb
    {
        #region ISQLite implementation
        public SQLite.SQLiteConnection GetConnection()
        {
            var sqliteFilename   = "MyDb.db3";
            string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var path             = Path.Combine(documentsPath, sqliteFilename);
            // Create the connection
            var conn             = new SQLite.SQLiteConnection(path);
            // Return the database connection
            return conn;
        }
        #endregion
    }
}

您可以使用外部存储选项:

        var sqliteFilename = "MyDb.db3";
        var extStoragePath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
        var path = Path.Combine(extStoragePath, "MyNewFolder");
        var filename = Path.Combine(path, sqliteFilename);

        // Create the connection
        var conn = new SQLite.SQLiteConnection(path);
        // Return the database connection
        return conn;

这样,文件将通过文件浏览器可见

谢谢您的回答。当我发布应用程序时,这也是一个好方法吗?或者我最好将其改回一次发布应用程序?发布应用程序时不建议这样做-用户可以查看、修改或删除您的应用程序数据。。