Android的备份API [英] Android Backup API

查看:116
本文介绍了Android的备份API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释一下完全 Android的备份API是用来干什么的?

Can anyone explain what exactly the Android Backup API is used for?

我已经阅读使用备份API 和的Data备份,但它仍然是我不清楚。

I have read Using the Backup API and Data Backup from the Developer Docs, but it is still unclear to me.

当在数据备份和放大器;恢复?

When is data backed up & restored?

特别是在这种情况下:

  1. 一个用户安装我的应用程序在设备1,数据备份,然后用户在设备2安装我的应用程序从设备1的用户数据自动置于设备2?如果是的话,会发生这种情况在安装应用程序时或当它启动?

  1. A user installs my app on Device 1, data is backed up, and the user then installs my app on Device 2. Is user data from Device 1 automatically put on Device 2? If so, does this occur when the app is installed or when it is launched?

我的应用程序安装在2个设备。当进行更改时对装置1,它会自动在设备2发?如果没有,是不是至少可以使变化对设备2?

My app is installed on 2 devices. When a change is made on Device 1 is it automatically made on Device 2? If not, is it at least possible to make the change on Device 2?

在一个文档,它说

备份服务不是设计用于同步的应用程序数据   与其他客户端或保存数据,你想在访问   正常的应用程序生命周期。您无法读取或写入的备份数据   需求和不能访问它以任何方式不是通过这些API其他   通过备份管理器提供的。

The backup service is not designed for synchronizing application data with other clients or saving data that you'd like to access during the normal application lifecycle. You cannot read or write backup data on demand and cannot access it in any way other than through the APIs provided by the Backup Manager.

但在另一个

Android框架可以帮助您构建丰富的云计算功能的应用程序,   同步他们的数据到远程网络服务,并确保所有设备   始终保持同步

the Android framework helps you build rich cloud-enabled apps that sync their data to a remote web service, making sure all your devices always stay in sync

这似乎是一个矛盾的我。

This seems like a contradiction to me.

更具体地讲,我要不断地同步单个数据库文件(小于20 KB)跨设备。与备份API这可能吗?

More specifically, I want to continually sync a single database file (less than 20 KB) across devices. Is this possible with the Backup API?

推荐答案

编辑:因此,要回答你的问题 - 不,这不是一个可靠的方法来同步您的数据。

So to answer your question - no, it is not a reliable way to sync your data.

当用户购买新的设备或重置其现有的,他们可能想到的是,当谷歌播放恢复您的应用程序返回到他们的设备在初始安装过程中,与应用程序相关的previous数据恢复也是如此。默认情况下,不会发生在你的应用程序的所有用户的成绩或设置都将丢失。

When a user purchases a new device or resets their existing one, they might expect that when Google Play restores your app back to their device during the initial setup, the previous data associated with the app restores as well. By default, that doesn't happen and all the user's accomplishments or settings in your app are lost.

在我看来您的应用程序将数据存储到云中。你推的文件复制到备份服务器,并使用API​​密钥(这是唯一的每个用户的Google帐户),使您可以将备份下载到其他设备,但在应用程序的安装或做手工的要求只能是访问。该文件规定:

As I see it your app is storing data to the cloud. You push the files to the backup servers and with the API key (that is unique to each users google account) allows you to download the backup to other devices but can only be accesses during the install of the app or by doing a manual request. The documentation states:

备份服务是不适合与其他客户端同步应用程序数据或保存,你想随意应用程序生命周期中访问数据。

The backup service is not designed for synchronizing application data with other clients or saving data that you'd like to access at random during the application lifecycle.

据我了解它(还没有实现这个我自己),你不能以此作为云同步实时数据的可靠方法。

As I understand it (without having implemented this my self) you cannot use this as a reliable method for cloud syncing real-time data.

该清单可能会启动您的数据的处理,并确定是否备份应推。

The manifest will probably launch the processing of your data and determine if a backup should be pushed.

目前在未来某一点上,备份管理器,然后调用备份代理的onBackup()方法

At some point in the future, the backup manager then calls your backup agent's onBackup() method

还原备份不是手动:

通常情况下,你不应该曾经有手动请求恢复,因为当你的应用程序安装在设备上自动执行。但是,如果有必要触发手动恢复,只需调用requestRestore()方法

Typically you shouldn't ever have to manually request a restore, as it happens automatically when your application is installed on a device. However, if it is necessary to trigger a manual restore, just call the requestRestore() method.

这篇关于Android的备份API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆