For an Necessitas/Android target, where do you put the ini files?

  • Hi,

    We have been developing for several targets who run Qt natively (Windows, Linxu x86 and Linux MIPS). But now we are trying to port our application to Andoid using Necessitas. The executable apparently works. But it is not fully functional with out reading data out of it's Qt ini file.

    So far, I have not been able to figure out where to put the ini.file so that our application will find it. We have been giving no path information to our application assuming that the ini file exists in the same directory as the executable. This has worked on all of the platforms we have been using thus far. But on Android this may not be the correct way to do this. After installing the application, an Android system appears to place the executable in /data/app. You need root privilages to see and write to this directory. I tried to make a symbolic link from this directory to the /mnt/sdcard where our ini file resided. That did not work.

    I suspect that the ini file should exist in "/data/data/<name_of_application>/files/Settings". However that does not appear to work either.

    Any help would be appreceated.


  • Moderators

    I'm not a necessitas expert, but have you tried "QSettings::setPath()":/doc/qt-4.8/qsettings.html#setPath yet?

  • I wanted to keep paths out of the "game". The reason is that the ultimate directory everything is installed into is different on each target. (For instance, the embedded target is using a SDCard while the simulation is using the Windows C: drive). If I start handing out paths, I will have to keep multiple versions of the code around or start using conditional compilation.

    (Conditional compilation is another can of "worms". I still have not figured out a way for Qt to differentiate between a Linux build box (i.e. x86 processor) and a Linux target (i.e. MIPS processor). To Qt (as far as I know), both are Linux boxes and are treated the same - which will obviously not work.)

    Right now, I'm guessing that if the ini file existed in the directory of the program which invokes the Qt program all would be well. But figuring that out does not appear trivial. I "ps" (processor status) the Android device hoping to get a hint of how the Qt application was started. Well, I see some processes were started using a complete path, but not the Qt application. It appears to have been started from with in the /data/app directory. And I already tried to place the ini file there. I am so confused at this point. I thought Android was supposed to be Unix like.

    Has anyone used files external to a Qt application on an Android yet? An ini file? An xml file? Does this even work. Or is it not supported by Necessitas yet?


Log in to reply

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