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. [SOLVED] QT on Android: Where to save data, eg. setting or highscore list

[SOLVED] QT on Android: Where to save data, eg. setting or highscore list

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 3 Posters 4.3k Views
  • 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.
  • E Offline
    E Offline
    evocat
    wrote on last edited by
    #1

    I'm developing a small game with QT on Android, and I've been wondering that where and how I should save highscore list? Highscores should (of course) stay in the memory even if user quits the app.

    I might also need to save a few settings, but they will probably go same way as the highscores?

    1 Reply Last reply
    0
    • GianlucaG Offline
      GianlucaG Offline
      Gianluca
      wrote on last edited by
      #2

      I use QSettings for all this stuffs and for a lot of other things.
      Very easy to use.

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

        Hi and welcome to devnet,

        You can use either QSettings or depending on the volume of data you could use a SQLite database which location you can retrieve using QStandardPaths.

        Hope it helps

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

        1 Reply Last reply
        -1
        • E Offline
          E Offline
          evocat
          wrote on last edited by
          #4

          QSettings seems to do the trick - at least in Windows environment. Thanks!

          But before I'll mark this as solved, I'll still ask two questions. ;)

          1. Which is the correct way to reset/empty the whole QSettings "file"?
            Is it
            @myQSettingsPointer->remove("");@

          or
          @myQSettingsPointer->clear();@

          or something else?
          (I tried to find that .ini file from my computer at the app's path, but I weren't there...)

          1. How easy it is for the end user with Android to modify QSettings's saved data, e.g. tweak his highscores?
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            1.AFAIK, clear is the right way.

            Depending on how you setup QSettings there's just no ini file.

            1. If you provide an editor for that, it should be pretty easy.

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

            1 Reply Last reply
            0
            • GianlucaG Offline
              GianlucaG Offline
              Gianluca
              wrote on last edited by
              #6

              For question 2, I think you mean how easy is for a user to open the QSettings file from outside the app and change it maliciously, right ?!?!
              If yes, then on Android it is possible only on rooted devices because the QSettings are stored in a private directory of the app not accessible from outside and from others app (unless the device is rooted).

              On iOS it is the same.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                evocat
                wrote on last edited by
                #7

                Yes, I meant question 2 as Gianluca undestood.

                In this case it is not a real problem since I'm not doing any on-line highscores or anything, but I just wanted to know.

                Anyway, I think that this case is clear & solved now. Thanks!

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

                  Yeah… I misread high score, I thought you wanted to provide a mean to modify some aspect of your game for testing...

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

                  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