Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Get AppDataLocation on Android device
Forum Updated to NodeBB v4.3 + New Features

Get AppDataLocation on Android device

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CharlieGC Offline
    CharlieGC Offline
    CharlieG
    wrote on last edited by CharlieG
    #1

    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

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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.

      (Z(:^

      1 Reply Last reply
      1
      • CharlieGC Offline
        CharlieGC Offline
        CharlieG
        wrote on last edited by
        #3

        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 ?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

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

          (Z(:^

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved