Wrote an application with minSdkVersion 14 . The application has implemented saving settings in SharedPreferences , as well as SQLite .
Everything works like this:
- user loads the application from
Google Play Google Playinstalls it.Androidshows in theStatusBar, the app is installed, but there is no shortcut on the desktop / home table. If you click on the notification in theStatusBaror on the application in the smartphone menu, it will start with the first launch already saved. And it should not be so.
The logic of work is as follows:
- Run the application
- Read
SharedPreferences - check for the first launch, if it was not there, then parse the data and write to the database, then save the first visit in
SharedPreferences.
But it all goes astray.
On Android 4.1.2, through the application manager, this application is erased, and then you can launch the application as a shortcut and that will be what I programmed. On Android 5.1.1, this number did not work. On Android 6.0, such a number has passed, but in an interesting order: erasing the application data, deleting the application. Then we install and everything is ok.
Is there any way to fix this? Or is there a code that will work if the application is deleted? That is, you can wipe the application data after it is deleted?
UPD0
boolean hasVisited = shared_prefer.getBoolean(APP_VISITED, false); if (!hasVisited) { // ... необходимые действия // 4. set appVisited setAppVisited(); } // метод setAppVisited() private static void setAppVisited() { SharedPreferences.Editor editor = shared_prefer.edit(); // ... editor.putBoolean(APP_VISITED, true); // записать первое посещение editor.apply(); }