Accessing Android storage locations

510 views
Skip to first unread message

Barbarur

unread,
Aug 29, 2022, 11:45:31 AM8/29/22
to Kivy users support
Hello Everyone,

I've been using python-for-android to access the app storage. Now I'm trying to switch and use plyer. The main reason is because I work on windows and python-for-android requires to work on Linux. I know creating a VM with ubuntu is unavoidable, but at the moment windows is where I am.

I've been using:
from android.storage import app_storage_path
settings_path = app_storage_path()

If I understood well, the alternative in Plyer is:
from plyer import plyer.facades.StoragePath
plyer.facades.StoragePath.get_application_dir()

Am I importing and using the method correctly?

Also, although python-for-android has only 3 options to access the storage, they are quite clear and straight forward. But on plyer, I'm not clear about some.

get_external_storage_dir()
get_home_dir()

What is the difference between these? I could understand the external as the external SD card, but plyer actually comes with get_sdcard_dir() also.


Robert

unread,
Aug 29, 2022, 1:04:47 PM8/29/22
to Kivy users support
Think of Android storage in terms of private storage and shared storage.
Also shared storage changes with Android 10.

None of that address your question about Plyer, which I don't use.
I find it easier to

from kivy.utils import platform

if platform == 'android':
    # whatever

Ngaga Dancan

unread,
Aug 29, 2022, 2:13:26 PM8/29/22
to kivy-...@googlegroups.com
Pretty coool send me more 
And can we get in touch am from Kenya

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/48799ad7-9347-496a-b401-e9d75dd221d7n%40googlegroups.com.

Robert

unread,
Aug 29, 2022, 5:39:04 PM8/29/22
to Kivy users support
Glad it helped.
I don't do 1 on 1, I try to document what I have to share, and prefer public conversations so we create a knowledge archive for future users.

Most everything have to share about Kivy on Android is
also the history in this group and on Discord.

Barbarur

unread,
Aug 30, 2022, 8:57:11 AM8/30/22
to Kivy users support
Hi Robert,

I understand the private storage and shared storage. p4a makes is straight forward:
app_storage_path                                -> it's the private storage for the app.
- primary_external_storage_path         -> Main share storage of the mobile.
- secondary_external_storage_path    -> Second main storage, in general a SD card. So it might doesn't exist.

Plyer with more options confuse me a bit.

I actually do similar as you
from kivy.utils import platform

if platform == 'android':
    from android.storage import app_storage_path
    settings_path = app_storage_path()

If you don't use Plyer of p4a. How do you get the path of the private storage of your app?

Robert

unread,
Aug 30, 2022, 1:05:14 PM8/30/22
to Kivy users support

Barbarur

unread,
Aug 31, 2022, 10:12:43 AM8/31/22
to Kivy users support
Oh, I see. I misunderstood you.

Actually, after reading the first link you shared, I might stick with p4a. The article mentions Plyer is not well maintained, so I checked the github and latest update seems 2 years ago. I guess I will keep using p4a for the time being, even though I don't install it on my venv.

The activity on Plyer github seems to contradict the notes on Kivy docs which states "p4a has been largely superseded by the more flexible Pyjnius and Plyer". Plyer definitely seems to provide more options on APIs than p4a, but without regular maintenance it bring me doubts on the reliability.
Reply all
Reply to author
Forward
0 new messages