0

I am targeting API 23 in my build.gradle. I have allowed backup in my manifest file. I could test auto update using adb shell commands. But auto back up is not happening on its own on my device.I have set "Back up my data" to ON in Settings -> Backup & Reset. Backup account is also set. But backup of my app is not happening.In "Manage Backups" in Google Drive settings, my app is not listed in the apps backed up to Google Drive. I am following other conditions like keeping wi-fi on, phone on charger and keeping it idle.Where am I going wrong? Is it because it's a debug app and not release app? Here are the configs in my build.gradle and manifest files:

Manifest

<application
            android:name=".app.GlobalState"
            android:allowBackup="true"
            android:fullBackupOnly="true"
            android:icon="@drawable/app_icon"
            android:label="@string/app_name"
            android:theme="@style/TripAppTheme"> 

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'Google Inc.:Google APIs:24'
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.spiritapps.android.tripplannerapp"
        minSdkVersion 16
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }

        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFile = file("$project.buildDir/apk/MyApp.apk")
            }
        }
    }
}

dependencies {
    compile 'com.android.support:support-v13:25.1.0'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.android.gms:play-services-base:10.2.0'
    compile 'com.google.android.gms:play-services-identity:10.2.0'
    compile 'com.google.android.gms:play-services-analytics:10.2.0'
    compile 'com.google.android.gms:play-services-drive:10.2.0'
    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
    compile 'com.google.android.gms:play-services-places:10.2.0'
    compile 'joda-time:joda-time:2.2'
}

Also, is wi-fi necessary or data connection will also work?

John Joe
  • 12,412
  • 16
  • 70
  • 135
shanti
  • 359
  • 5
  • 20

1 Answers1

1

I have got it working, here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
          android:versionCode="2" 
          android:installLocation="auto" 
          package="com.example.myApplication" 
          android:versionName="2.0">
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
    <application android:label="My Application" 
                 android:icon="@drawable/icon" 
                 android:fullBackupContent="true"/>
</manifest>

Also, with this manifest, I have "deploy"ed the application to the device, instead of just running/debugging from the IDE. Obviously, I had to wait for few hours to know this thing was working, as we have no control over when the backup process kicks off on the device.

Oh, BTW, I was using Xamarin Forms and VS2017. HTH.

Suresh
  • 4,091
  • 28
  • 35
  • Do you really have to set mindsdkversion=23, if i have 19, everything under 23 should be ignored for autobackup I thought? – Emil Mar 21 '18 at 22:54
  • how do you understand that it is working? what do you see in your google drive account? do you see name of your app or is it bundled with phone data backup? – Emil Mar 22 '18 at 13:54