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



  • 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?



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


  • Lifetime Qt Champion

    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



  • 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?

  • Lifetime Qt Champion

    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.


  • 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.



  • 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!


  • Lifetime Qt Champion

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


Log in to reply
 

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