Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cannot create a directories and files
Forum Updated to NodeBB v4.3 + New Features

Cannot create a directories and files

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 640 Views 2 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.
  • Alex RusA Offline
    Alex RusA Offline
    Alex Rus
    wrote on last edited by Alex Rus
    #1

    Hi all! I have not been able to solve this problem for a very long time, so I'm writing to you.
    In shot: permission to change internal memory isn’t issued and folders/files aren't create (on most devices).

    I have a multi-platform application that has a log system. Logging occurs in a separate file, which is created when the application starts. On the Window - everything works fine. On Android – it's never work except my personal smartphone (Android 5.1). On other devices, neither directories nor files are even created. At the same time, only on my phone the application does have the necessary permissions (work with memory and the network), on the others (at least one that is for tests, Android 8.1.0) - they are not and they are no question about it during installation. However, even when the application is given permission to change the memory, the result is same.
    Here is creenshot of my AndroidManifest.xml:
    2020-05-21_20-15-57.png

    And test code where i'm trying to create dir or file:

    QString testPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Hom loc";
    QDir().mkdir(testPath);
    QFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/UHomLoc log.txt").open(QIODevice::ReadWrite);
            
    testPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/AD loc";
    QDir().mkdir(testPath);
    QFile(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/UADLoc log.txt").open(QIODevice::ReadWrite);
            
    testPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/GD loc";
    QDir().mkdir(testPath);
    QFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/UGDLoc log.txt").open(QIODevice::ReadWrite);   
    

    I hope for your help!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Just a wild guess but are you requesting the correct write permissions on Android ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Alex RusA 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Just a wild guess but are you requesting the correct write permissions on Android ?

        Alex RusA Offline
        Alex RusA Offline
        Alex Rus
        wrote on last edited by Alex Rus
        #3

        @SGaist said in Cannot create a directories and files:

        Hi,

        Just a wild guess but are you requesting the correct write permissions on Android ?

        Hey! If you're about AndroidManifest setting - then yes, I'm pretty sure that these are right ones. These options are offered in topics on this issue, i also scrolled through all the options and think so. There are no such thing as "Read_internal_storage" or "Write_internal_storage"

        UPD: Yeap https://developer.android.com/training/data-storage
        It seems that these permissions just aren't give during installation and user can't issue them after :\

        1 Reply Last reply
        0

        • Login

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