How to ship files on Android with Necessitas



  • Hello everyone,

    I am developping an app for Android using Necessitas that interfaces with a sqlite database. The problem is that this database already exists, and I need to ship it with the app. Do you know how to do this?

    I think this problem is not database related but more generally to all files.

    Thanks,
    Seba84


  • Moderators

    Add it to qmake's DEPLOYMENTOLDERS or DEPLOYMENT ("link":http://qt-project.org/forums/viewthread/2556). You can also search on Necessitas forum, I remember there was a similar topic a few months ago ("link":https://groups.google.com/forum/#!forum/android-qt).

    You can also use QRC, but that would give you a read-only DB, which is not nice :)



  • Thanks sierdzio for the quick answer!

    I tried to do the DEPLOYMENT method in your link and didn't worked, I must be doing something wrong. After investigating a bit the method in the net, here it is another solution that didn't work neither:

    @
    deployment.files = stock.dba
    deployment.path = /data/data/org.kde.necessitas.example.test/files

    INSTALLS += deployment
    @

    Taken from this "link":http://techbase.kde.org/Development/Tutorials/Necessitas.

    Anyway I managed to upload the database file through my mail box (I send myself an email and downloaded the attachment in the tablet), then I found where it was stored (thanks to QFileDialog) and that was solved. For the time being I don't in how many tablets I will need to install the software, but it is clear that I cannot do this each time.


  • Moderators

    Well yes, that's clearly suboptimal :) Unfortunately I can't help you more - for my use cases, QRC is enough and that is all I've used to date (on droid, that is). I think it's possible to use some native Android tools to do that. If it's not on official forum, try searching on mailing list. I'm sure I've seen it somewhere.


  • Moderators

    Ah, there it is! Turned out it was in my bookmarks :P Here you go, hope that helps: "LINK":http://techbase.kde.org/Development/Tutorials/Necessitas.



  • By the way, when trying to open the db, I found the QSQLITE driver not loaded error. This was simply solved by adding the following line in the main() function:
    @ a.addLibraryPath("/data/data/org.kde.necessitas.ministro/files/qt/plugins"); @

    just after the QApplication declaration.


  • Moderators

    That's a nice trick, thanks for sharing. Be sure to check out my last post, you might have missed it cause we posted almost simultaneously.



  • Yes, we posted simultaneously.

    You can see I used the same link for the code before. But I couldn't make it work. And I don't see in the compilation, deployment and execution phases anything saying that the files are being copied.

    I used QFileDialog to explore the tablets storage media but I couldn't find the file (expect for the one I downloaded from my mailbox).


  • Moderators

    Sad. Regrettably, I have nothing more to add, then, apart from suggestion to ask on Necessitas forum and/ or mailing list.



  • [quote author="Seba84" date="1335785134"]Yes, we posted simultaneously.

    You can see I used the same link for the code before. But I couldn't make it work. And I don't see in the compilation, deployment and execution phases anything saying that the files are being copied.

    I used QFileDialog to explore the tablets storage media but I couldn't find the file (expect for the one I downloaded from my mailbox).[/quote]

    Did you find a solution for this issue? I'm suffering from it right now and I digget it deep into Necessitas mailing list and got nothing!


Log in to reply
 

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