Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-140652

Documentation about how to use QSettings on Android.

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.9.2
    • Documentation
    • None
    • Android

      Dear Sir,

      I made an app. On desktop, it works fine. I compiled for Android and run. 
      I load/save data though QSettings and it is not working out of the box on Android system. 
      I'm still in a developer mode: compilation in debug, I didn't touch the AndroidManifest.xml or any thing. Just compilation and run. 
      My settings works like a charm on Desktop; but on Android (run from QtCreator) on my device. I had trouble to have persistent data. 

      I found no information or warning about what QSettings needs to work normally on Android.

      Do I have to ask for permissions ? (if yes, which ones?)
      There is no chapter about Android on the QSettings page. May be a small paragraph saying: on android, you should do that and it will work, or until you do that you won't get persistent data… 
      I take a look to the manifest editor, and there is a checkbox about default permissions for Qt modules ? What's inside ? It will cover the permission for QSettings ?

      I can find a lot of workaround and homemade solution. I'm curious to see what's the Qt recommended way to use QSettings  on Android. 

      My settings are defined like that:

      ```

      QSettings settings( "orga", "app"); // parameters have been changed
      ```

      Workaround (which seems to work a little bit better but not enough)
      ```
      const QString configfile("config.ini");
          auto path= QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
          auto filePath= QStringLiteral("%1/%2").arg(path, configfile);
         QSettings settings(QStringLiteral("%1/%2").arg(path, configfile));

      ```

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            docteam Qt Documentation Team
            obiwankennedy renaud.guezennec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes