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 Play installs it. Android shows in the StatusBar , the app is installed, but there is no shortcut on the desktop / home table. If you click on the notification in the StatusBar or 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:

  1. Run the application
  2. Read SharedPreferences
  3. 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(); } 
  • one
    According to the verbal description, no one will tell you anything. The code does not work - you need a code. As in preferences, the first launch determines, the manifest and everything else that is connected with the problem. And here is a slow google play? - pavlofff
  • @pavlofff, laid out work with SP, why the manifest? Goole Play here despite the fact that earlier he quickly created shortcuts for applications for me, but now I have to wait another 5 seconds. And this is despite the fact that the smartphone is completely unloaded from background applications. - web_alex pm

0