Forums

OverviewFelgo 2 Support (Qt 5) › How to write files on an Android device?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22152

    Abe Burks

    I tried to use fileUtils for an Android app, but the write operation doesn’t work:

     

    W MyApp : [WARNING] File open for “/storage/emulated/0/Documents/note-1568593407.txt” did not work.

     

    I think this happens, because of the requirement, that the user has to grant access to file storage. Setting the permission in the manifest file is not sufficient any more. Does Felgo  offers a solution or do I have to implement some JNI stuff?

    #22159

    Alex
    Felgo Team

    Hi,

    your chosen location might indeed require an extra permission. There is no QML API available for this yet, you can use the C++ API (https://doc.qt.io/qt-5/qtandroid.html#requestPermissions) or use JNI. You can use JNI just like with normal Qt.

    Alternatively you can also choose another non-external storage location (e.g. FileUtils.AppDataLocation) that does not require an additional permission.

    Note that if you want to use QML live reloading together with C++ or native code, you can build your own Live Client: https://felgo.com/updates/release-2-16-1-live-code-reloading-with-custom-c-and-native-code-for-qt#how-to-build-your-own-live-client-with-custom-cpp-and-native-code

    Cheers,
    Alex

    #22198

    Abe Burks

    Thanks for the suggested solution. For demonstration purpose, I’ll try the local storage and add the request for permission in my Qt class for opening and storing files.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support