An Android app remembers its data after uninstall and reinstall

后端 未结 8 2268
半阙折子戏
半阙折子戏 2020-11-28 17:58

While developing an Android app targeting all versions above 4.1, I observed that uninstalling my app and installing it again does not clear its data.

The app is d

8条回答
  •  一向
    一向 (楼主)
    2020-11-28 18:35

    If you are targeting android 10 then you have to put android:hasFragileUserData="true" in application tag of AndroidManifest.xml

    
    
      
    
        .....
    
         
    
     
    

    android:hasFragileUserData is a new manifest setting (I’m guessing on ). “If true the user is prompted to keep the app’s data on uninstall”. This seems ripe for abuse, but I can see where it might be useful for some apps.

    See https://commonsware.com/blog/2019/06/06/random-musings-q-beta-4.html

提交回复
热议问题