I face very weird situation on certain device (Nexus 5x with Android 7): when I clean its data and uninstall it, then install it with Studio, the app is not unitialized but it uses data from 24th january! I tried the same procedure with a tablet and the app has no data.
I have repeated this procedure many times, I cleaned my project, rebuilt it multiple times and it always starts with 24th january data (both database and shared prefs).
I even tried adb shell and run as to clean up data:
bullhead:/data/data/lelisoft.com.lelimath.debug $ ls -l databases/ total 232 -rw-rw---- 1 u0_a259 u0_a259 98304 2017-02-05 11:03 lelimath.sqlite -rw------- 1 u0_a259 u0_a259 16928 2017-02-05 11:03 lelimath.sqlite-journal
I deleted them and the app seemed empty - until I deleted it and installed again - 24th january was back.
This is a log how it starts:
$ adb shell am start -n "lelisoft.com.lelimath.debug/lelisoft.com.lelimath.activities.DashboardActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D Waiting for application to come online: lelisoft.com.lelimath.debug | lelisoft.com.lelimath.debug.test I/InstantRun: Instant Run Runtime started. Android package is lelisoft.com.lelimath.debug, real application class is lelisoft.com.lelimath.helpers.LeliMathApp. D/l.c.l.h.LeliMathApp: onCreate() D/l.c.l.h.BalanceHelper: Current points balance: 234
This is a location of a database, got from a debugger:
/data/user/0/lelisoft.com.lelimath.debug/databases/lelimath.sqlite
Gradle:
android { signingConfigs { } compileSdkVersion 24 buildToolsVersion "23.0.3" defaultConfig { applicationId "lelisoft.com.lelimath" resValue 'string', 'app_name', 'LeliMath' minSdkVersion 16 targetSdkVersion 24 versionCode 300 versionName '3.0.0' resValue "string", "app_build_number", getDate(); resValue "string", "app_version", versionName; } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { applicationIdSuffix ".debug" resValue 'string', 'app_name', 'LeliMath DEV' } }
Manifest portion:
<application android:name=".helpers.LeliMathApp" android:allowBackup="true" android:fullBackupContent="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning">
I do not want o factory reset my phone to get rid off this data. I do not think that this data is in my build. I have not added them and the app in the tablet was empty when installed.
Apps that target Android version 6.0 or higher are automatically enabled for Auto Backup. The Auto Backup feature is a file-based approach to backing up app data.
Since Android 6.0 (v 23) onward, Android introduced a new feature called Auto-backup for apps . What this does is, it performs a backup of certain files of an application to a user's Google drive. The list of files it updates include:
getFilesDir()
getDatabasePath(String)
getDir(String, int)
getExternalFilesDir(String)
Now this line in the manifest.xml
is responsible for it :
android:allowBackup="true"
If you prefer to disable the backup, should you choose to set the value to false
.
Furthermore, the data backed up is in a 24 hour interval and Android uses the JobScheduler API for this purpose, so which means a user has no control over the process of data being transferred.
Also, the space for auto-backups is limited to 25
MB , and which is not counted against the user's space quota.
Also, you can set to <include>
and <exclude>
certain type of data being uploaded, for instance you may not need to save a user confidential data, so it is flexible for that as well, more info on that is available at : Android Auto Backup for Apps (100 Days of Google Dev)
<application ... android:allowBackup="false" android:fullBackupContent="false" tools:replace="android:allowBackup" </application>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With