如何擦除自动备份数据

时间:2016-02-17 14:12:33

标签: android android-6.0-marshmallow android-backup-service

我读过this文章。如您所见,它表示我需要执行以下命令:

adb shell bmgr wipe <TRANSPORT> <PACKAGE>

请注意我使用的是Windows操作系统。

要获取Transport值,我执行了以下命令:

adb shell bmgr list transports

它返回了以下列表:

    android/com.android.internal.backup.LocalTransport
  * com.google.android.gms/.backup.BackupTransportService

我尝试使用以下所有命令擦除数据:

adb shell bmgr wipe android/com.android.internal.backup.LocalTransport com.myapp
adb shell bmgr wipe * com.google.android.gms/.backup.BackupTransportService com.myapp
adb shell bmgr wipe com.google.android.gms/.backup.BackupTransportService com.myapp
adb shell bmgr wipe com.google.android.gmsandroid/com.android.internal.backup.LocalTransport com.myapp
adb shell bmgr wipe com.google.android.gms* com.google.android.gms/.backup.BackupTransportService com.myapp
adb shell bmgr wipe com.google.android.gmscom.google.android.gms/.backup.BackupTransportService com.myapp
adb shell bmgr wipe com.google.android.gms.android/com.android.internal.backup.LocalTransport com.myapp
adb shell bmgr wipe com.google.android.gms.* com.google.android.gms/.backup.BackupTransportService com.myapp
adb shell bmgr wipe com.google.android.gms.com.google.android.gms/.backup.BackupTransportService com.myapp

但是他们都没有工作,即在安装应用程序之后仍有来自先前安装的数据。那么我应该使用哪个命令来擦除自动备份数据呢?

2 个答案:

答案 0 :(得分:1)

我想知道我必须以哪种形式进入TRANSPORT。谢谢你的测试! 如果您想擦除备份而无法擦除备份,因为不清楚如何正确调用擦除,您可以尝试禁用并启用自动备份。

adb shell bmgr enable false
adb shell bmgr enable true

引用https://developer.android.com/studio/command-line/bmgr.html最后一段:

  

警告!禁用备份时,当前备份传输将从其后端存储中显式擦除整个活动数据集。这样,当用户说他们不希望备份数据时,备份管理器会尊重这一愿望。除非重新启用备份管理器(通过“设置”或通过上述bmgr命令),否则不会从设备保存更多数据,也无法执行还原操作。

答案 1 :(得分:0)

列出运输:

# curl -Lv http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* connect to ::1 port 8080 failed: Connection refused
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 403 Forbidden
* Server nginx is not blacklisted
< Server: nginx
< Date: Thu, 21 Jun 2018 21:40:16 GMT
< Content-Type: text/html
< Content-Length: 162
< Connection: keep-alive
< 
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host localhost left intact

要取消备份,请使用所选的传输方式(带有*的传输方式)和程序包ID:

adb shell bmgr list transports

您应该得到一个结果:

adb shell bmgr wipe  android/com.android.internal.backup.LocalTransport  com.test.myapp