JulianAssmann/flutter_is_first_run

Android devices: "first run" wrongly reported after uninstallation/reinstallation, when Google backup is ON on an Android device

Opened this issue · 0 comments

The code assumes that _firstRunSettingsKey does not exist in shared preferences immediately after the app installation.

However, if the Android device's automatic backups setting is ON, the device data will be backed up once per day (and saved in the user's Google Drive account).

After the first backup is made, an uninstall/install will first automatically restore (behind the scene) any previously backed-up app data (shared preferences included), BEFORE the app is started "for real".
Therefore, _firstRunSettingsKey will be present when the app starts, and so the package will report that the app isn't run for the first time, which is not correct, since it was uninstalled & installed.

NB: this can be reproduced (1) if automatic Google backups is set to ON on the Android device, (2) after more than 1 day after the first installation, allowing time to Android to automatically backup the app data, and (3) if the device has an internet connection, which is usually the case.