Get AppDataLocation on Android device



  • Hello,

    In the documentation, QStandardPaths.AppDataLocation should return for Android device : "<APPROOT>/files", "<USER>/<APPNAME>/files".

    So in my case, with this code :

    StandardPaths.writableLocation(StandardPaths.DataLocation[1])
    StandardPaths.writableLocation(StandardPaths.DataLocation[0])
    

    I would like to have :

    • file:///Android/data/net.jiyuusoft.myApp/files
    • file:///data/user/0/net.jiyuusoft.myApp/files

    Unfortunatly, I can't get "<APPROOT>/files" (file:///Android/data/net.jiyuusoft.myApp/files). I only get "<USER>/<APPNAME>/files".

    My problem is that I don't find "data/user/0/net.jiyuusoft.myApp/files" in my device... so I can't check if my app use the right files (Docs, example, ...).

    Do you know how do to have the good path ?

    Thank you in advance.

    Charlie


  • Moderators

    To access "data/user/0/net.jiyuusoft.myApp/files" in a file explorer on Android, you need a rooted device and root explorer. That is because APPROOT is intended to be a "sandbox" for the app - only the application has access there.



  • Hi,

    I don't want access "data/user/0/net.jiyuusoft.myApp/files", but I want access "/Android/data/net.jiyuusoft.myApp/files".

    With C++, this is possible with :

    QString dataLocation = standardPath->standardLocations(QStandardPaths::DataLocation)[1];
    

    But I can't do it with QML, because

    StandardPaths.writableLocation(StandardPaths.DataLocation[1])
    StandardPaths.writableLocation(StandardPaths.DataLocation[0])
    

    only return "data/user/0/net.jiyuusoft.myApp/files".

    Have you an idea ?


  • Moderators

    Hm, I see. I don't have an idea apart from recommending you to use C++ code in this case :-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.