Skip to content

not able to acess files unless connected to adb once  #2907

@0Beshoy

Description

@0Beshoy

I have a kivy app that creates a directory called DownTunes in Music Public Directory and downloads music in it the app works fine on my phone i tried it on another phone it opened correctly but it didnt create the directory DownTunes nor downloaded anything so i connect this phone to the laptop and open adb to see the erro,r the app worked fine after i connected to adb, i tried reinstalling disconnecting and everything and it still worked, i tried it on 2 other phones and it didnt work , it appears to me that the app is unable to acess phone storage unless connected to adb once , anyone knows why ? here is my code for acessing storage ( i tried to create the directory manually and then download it didnt work)

if platform == "android":
from android.permissions import request_permissions, Permission

request_permissions(
    [
        Permission.INTERNET,
        Permission.WRITE_EXTERNAL_STORAGE,
        Permission.READ_EXTERNAL_STORAGE,
        Permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
    ]
)

Environment = autoclass("android.os.Environment")
path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_MUSIC
).getAbsolutePath()
File = autoclass("java.io.File")
down_tunes_directory = File(path, "DownTunes")

@mainthread
def create_directory(dt):
if not down_tunes_directory.exists():
down_tunes_directory.mkdirs()

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