📜 ⬆️ ⬇️

Android data migration tools and improved application support

Hi, Habr! I present to you the translation of the article “Discover data for Android data migration and improve your app retention” by Sean McQuillan and Prateek Tandon.

Users create accounts, activate them, and then save them when they launch the application many times. Usually, the user does not need to re-enter the password for the Android application for many years, that is, until he purchases a new phone.
Buying a new phone is a rare event for many people. It may take several years between updating devices. There are several tools that will help users log in when they use the application on a new phone.

Backup Application Data


Autoload must be configured for each application. This feature automatically backs up application data. Therefore, when people receive a new phone, their data from the applications are automatically restored before the application is launched.
To set up autoloading the application, you need to set the inclusion and exclusion rules:

AndroidManifest.xml
')
<application ... android:fullBackupContent="@xml/autobackup"> 

xml / autobackup.xml

 <?xml version="1.0" encoding="utf-8"?> <full-backup-content> <include domain="sharedpref" path="."/> <exclude domain="sharedpref" path="device.xml"/> </full-backup-content> 

When setting up include and exclude rules, it is important to avoid storing sensitive user data in Auto Backup, although this is a great place to store user settings and other application content.

To implement tracking for Auto Backup, register BackupAgent and listen for the onQuotaExceeded callback. If your application exceeds the 25 MB backup limit, this callback will be a crash notification. In a well-configured application, this will never happen, so you can track it as a crash report.

Optimize login


Users do not want to re-enter login and password. There are several ways to solve this problem:

1. Using Google Sign-In, users can sign in with their Gmail account or any email address. Most importantly, they do not need to remember the password. In addition to improving registration and activation, enabling Google login will also help with saving, as it allows those who receive new phones to activate with a single button or even automatically. You can also use Google Sign-In to log into iOS, Web, and Android applications. Also, if your application uses Firebase Auth to handle Google login.

2. Make the login process easier with Google Smart Lock and Autofill. These two functions work hand in hand to help people safely access their passwords. Autofill was introduced in Android O and will offer to automatically save user passwords in the Smart Lock data store or in the preferred password manager when you log in. Configure AutoFill hints and exclude fields that should not be filled with Autofill.

 <TextView android: id = "@ + id / username" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: autofillHints = "username" /> <TextView android: id = "@ + id / password" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: autofillHints = "password" /> <TextView android: id = "@ + id / captcha" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: importantForAutofill = "no" /> 

3. Integrate Smart Lock with API for securely storing passwords. Smart Lock is backward compatible with API 9 and works fine on devices with older versions of Android that do not work with Autofill. Like Autofill, Smart Lock API will offer to save user passwords after logging in. Smart Lock API's software search allows you to automatically return to user input, even on new devices and in Chrome. To support this Smart Lock feature, you will need to include some code in the application; Check Codelab to learn how to integrate Smart Lock for passwords into an application. Also, don't forget to link your app to the website to ensure unhindered access to Chrome using Autofill and Smart Lock.

4. Using the Account Transfer API, think in advance so that your application can transfer credentials from the old phone to the new one. The application uses an encrypted bluetooth or cable, and you can transfer data from phones with API 14 or higher. Account transfer occurs when a user of your application configures your new phone the first time your application is reinstalled from Google Play, your application credentials will be available the first time you start it.

Codelabs

You can also configure autoload for Android Codelab and SmartLock Codelab.

Now you can facilitate data migration with a set of tools: transfer settings using Auto Backup, logging in to the system by logging into your Google account, Smart Lock for passwords, autocomplete, and the account migration API.

Source: https://habr.com/ru/post/350114/


All Articles