android - Android 使用 Google Drive 将房间数据库文件的备份还原到 Android
问题描述
我尝试使用以下代码将房间数据库备份到谷歌驱动器。打开失败错误。有人请帮我确定问题吗?请分享链接或代码以备份房间数据库到谷歌驱动器
`文件存储文件 = 新文件();storageFile.setParents(Collections.singletonList("root")); storageFile.setName("sample_database");
String fileId = "/data/data/packagename/databases/sample_database.db";
java.io.File filePath = new java.io.File(fileId);
FileContent mediaContent = new FileContent("",filePath);
try {
File file = mDriveService.files().create(storageFile, mediaContent).execute();
System.out.printf("Filename: %s File ID: %s \n", file.getName(), file.getId());
}
catch(UserRecoverableAuthIOException e){
} `
解决方案
推荐阅读
- c# - MailKit - SmtpClient Connect 方法冻结
- c# - Azure函数使用实体框架但连接字符串不起作用
- javascript - 为 ag-grid 定义仅一个特定列的自动大小列是可能的吗?
- php - Laravel 与自定义键的多态关系
- javascript - 使用 jQuery.when() 调用两个 Html2Canvas 调用
- r - 将日期和时间与时间戳分开
- android - 当 ViewPager 中的片段出现和消失时如何执行一些代码
- kubernetes-ingress - istio 新安装导致 readinees 探测失败
- postgresql-9.6 - Postgres:选择数据到 jsonb 对象
- neural-network - 使用梯度更新神经网络中的权重和偏差