Skip to content

How to completely remove installed app? #953

Closed

Description

@JonAnCla

I'd like to test what happens on first install of my app, but there seems to be some residual settings (kivy config?) files stored somewhere that aren't deleted when I uninstall the app, or when I "Clear app data" as per this link

What steps do I need to follow to completely delete the app, all settings and all user data?

Thanks!

Activity

  1. KeyWeeUsr commented on Dec 8, 2016

    @KeyWeeUsr
    Contributor

    With the latest version of p4a I experience no such thing.

    • interpreter + kv: data/data/your.app.name
    • java stuff + jni/C: data/app/your.apk

    Maybe you've tried App.user_data_dir, which is a folder on sdcard/your.app.name or I think I saw it even in sdcard/Android/your.app.name and your app uses such config from user_data_dir?

  2. JonAnCla commented on Dec 8, 2016

    @JonAnCla
    ContributorAuthor

    Thanks, I'll look into this further... In case it makes a difference I'm still using the SDL/Pygame bootstrap.

  3. JonAnCla commented on Dec 8, 2016

    @JonAnCla
    ContributorAuthor

    Aha just found it...
    The file ".myapp.ini" (Kivy config file for my app) is stored in "Main Storage" i.e.
    /storage/emulated/0/.myapp.ini

    My app's user_data_dir folder is:
    /storage/emulated/0/myapp

    These don't get deleted if I uninstall my app. Is this an issue with the pygame bootstrap?

  4. JonAnCla commented on Dec 8, 2016

    @JonAnCla
    ContributorAuthor

    Probably something to do with this change which I may not have pulled into my p4a repo... Will verify later - sorry for the posting noise.

  5. KeyWeeUsr commented on Dec 8, 2016

    @KeyWeeUsr
    Contributor

    No, this is purely Kivy thing and I didn't find anything from p4a to even target such file (that env. var is something different). I think it's just unhandeled behavior from the Kivy side, because the Config for some reason places the .ini outside of the app folder.

    I'm not sure if it's desired, however the app contains the default kivy.ini file at the same folder where folder with logs is (data/data/...) and you probably should target that file if needed. It's still an issue so I'll open one in Kivy repo.

    If you'd target kivy.ini file and your app is both android and e.g. some desktop, your default desktop config will be most likely overwritten (<user profile>/.kivy/config.ini)

  6. JonAnCla commented on Dec 10, 2016

    @JonAnCla
    ContributorAuthor

    Checked this with newest p4a and yes, config file and user_data_dr still reside in the same place and are not deleted with the app. However I don't have the same issue on ios. Can close if this should be moved to kivy repo? Cheers

  7. KeyWeeUsr commented on Dec 10, 2016

    @KeyWeeUsr
    Contributor

    Are you sure there are no leftovers in iOS somewhere in the system? About the user_data_dir, that folder isn't deleted anywhere afaik - desktops & android.

  8. JonAnCla commented on Dec 11, 2016

    @JonAnCla
    ContributorAuthor
  9. KeyWeeUsr commented on Dec 12, 2016

    @KeyWeeUsr
    Contributor

    @hottwaj Could you please post some minimal example that creates such a config file? I tested with latest kivy and p4a this one:

    from kivy.base import runTouchApp
    from kivy.uix.boxlayout import BoxLayout
    from kivy.config import Config
    Config.set('graphics', 'height', 50)
    Config.write()
    runTouchApp(BoxLayout())
    

    But both on Windows and Android it either creates a new one or overwrites in:

    • Windows -> %appdata%/.kivy/config.ini
    • Android -> /data/data/app.dir/app/.kivy/config.ini or if sdl2 launcher /sdcard/kivy/app/.kivy/config.ini

    If your code uses Config.read() or Config.update_config() it's most likely your fault by choosing a path that's not automatically deletable. Still I think I've seen this behavior before, but I'm not sure how to reproduce.

  10. JonAnCla commented on Dec 14, 2016

    @JonAnCla
    ContributorAuthor

    Sure I will get this done, but probably not until next week - busy times! Cheers

  11. KeyWeeUsr commented on Dec 22, 2016

    @KeyWeeUsr
    Contributor

    @hottwaj Please don't forget about this issue, it seems really useful for resolving the additional permission of casual kivy apps.

  12. JonAnCla commented on Dec 22, 2016

    @JonAnCla
    ContributorAuthor

    Sure, I have it on my list. I just looked through my config code and can't see anything obvious - I don't use Config.read of Config.update_config.

    It will take me more time to build a simplified test I'm afraid.

    In the meantime in case it's useful, I use the following config related functions, roughly in this order:
    First I provide a build_config method for my app in which I use config.setdefaults.
    Later I use config.getint, config.set and config.write during the build() method of my app (when the app runs for the first time)
    I use app.load_config somewhere.
    I also use ConfigParserProperty in a few places.

    Sorry, probably not very helpful... will try to put a simple test together soon. Thanks

  13. KeyWeeUsr commented on Dec 22, 2016

    @KeyWeeUsr
    Contributor

    Probably it won't be needed anymore, the description was enough. It's the example from App docs. So yeah, a bug 🙍 thanks for the description.

    from kivy.app import App
    from kivy.uix.label import Label
    
    
    class TestConfigApp(App):
        def build_config(self, config):
            config.setdefaults('section1', {
                'key1': 'value1',
                'key2': '42'
            })
    
        def build(self):
            config = self.config
            return Label(text='key1 is %s and key2 is %d' % (
                config.get('section1', 'key1'),
                config.getint('section1', 'key2')))
    
    TestConfigApp().run()
    
  14. JonAnCla commented on Dec 23, 2016

    @JonAnCla
    ContributorAuthor

    Cool, glad that description was helpful! Thanks

  15. llfkj commented on Jan 3, 2017

    @llfkj

    Uh oh. I currently rely on this (mis?)feature. Can you give me some time to have a more detailed look and think of a solution that addresses both the described issue, and the way I'm currently using it?

  16. KeyWeeUsr commented on Jan 3, 2017

    @KeyWeeUsr
    Contributor

    @llfkj here, I zoomed it for you 🐼 bad line. This is why the config is thrown to sdcard like if it is a root folder. It could be fixed with targeting directly external storage directory, which I guess is removed after uninstalling the app (or removing its data, testing welcome).

    More about it here. According to that quote it's removed, yet I experienced weird stuff on Gingerbread like 2 years ago, so...:

    The SDK provides us with handy methods to determine where to put our stuff. These places will be deleted automatically when a user removes our apps and this keeps things tidy.

    That, however, fixes things only for android and I'm still waiting for a reply about iOS, so that it could be fixed globally. :)

  17. inclement commented on Jan 31, 2019

    @inclement
    Member

    Closing as a Kivy issue rather than a p4a one, which we're aware of and working to fix.

  18. inclement commented on Jan 31, 2019

    @inclement
    Member

    @Jonast Thanks, I wasn't sure if it was actually fixed yet. That's great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions