Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to completely remove installed app? #953

Closed
hottwaj opened this issue Dec 8, 2016 · 19 comments
Closed

How to completely remove installed app? #953

hottwaj opened this issue Dec 8, 2016 · 19 comments

Comments

@hottwaj
Copy link
Contributor

hottwaj commented Dec 8, 2016

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!

@KeyWeeUsr
Copy link
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?

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 8, 2016

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

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 8, 2016

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?

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 8, 2016

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.

@KeyWeeUsr
Copy link
Contributor

KeyWeeUsr commented Dec 8, 2016

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)

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 10, 2016

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

@KeyWeeUsr
Copy link
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.

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 11, 2016 via email

@KeyWeeUsr
Copy link
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.

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 14, 2016

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

@KeyWeeUsr
Copy link
Contributor

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

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 22, 2016

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

@KeyWeeUsr
Copy link
Contributor

KeyWeeUsr commented Dec 22, 2016

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()

@hottwaj
Copy link
Contributor Author

hottwaj commented Dec 23, 2016

Cool, glad that description was helpful! Thanks

@llfkj
Copy link

llfkj commented Jan 3, 2017

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?

@KeyWeeUsr
Copy link
Contributor

KeyWeeUsr commented Jan 3, 2017

@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. :)

@inclement
Copy link
Member

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

@ghost
Copy link

ghost commented Jan 31, 2019

@inclement just for what it's worth, pretty sure it's already fixed on kivy master with the recent config & user data location change on android. (I pushed for that one because of the SDL2 upgrade that introduced the permission stuff that needs it) 👍

@inclement
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants