Open file dialog on exported apk

0 favourites
  • 7 posts
From the Asset Store
10 Orchestral Soundtracks / ~2 mins each / 11 audio clips in total
  • I'm trying to create a way for a user to open up .csv files on a mobile app.

    While debugging I set up a way to do this with both the FileSystem plugin and the NW.js. The FileSystem way works while trying preview layout and both work when running this on a standalone NW C3.

    When exporting this to a debug .apk I can't get the file open dialog to appear. I have searched online for a reason but nothing comes up. I thought maybe this had something to do with app permissions on the phone but even though I allow everything the dialog will not show up.

    Does anybody know what I could try out?

  • FileChooser doesn't work on mobile. You will probably need to install a third-party Cordova plugin, like this one. And the app will require permissions to access files and folders.

  • It's strange that the file dialog for the nw.js plugin doesn't work, right?

    I'm trying to do this all vanilla C3 but if that is not possible I will look at a third-party approach. I am not sure how to implement this Java code to my project but I guess there is some tutorial for that :)

  • It's strange that the file dialog for the nw.js plugin doesn't work, right?

    NW.js is for desktop, it doesn't work on mobile.

    With Cordova plugin you have two options:

    1. Find someone who can make it into a C3 addon.

    2. Export your game as Cordova project and manually add the Cordova plugin using Cordova CLI, Android Studio or XCode. You will need to call plugin methods with Javascript, but this isn't very hard. For example, to open the file dialogue:

    fileChooser.open(successCallback, failureCallback);
    
  • AFAIK the File Chooser object does work on mobile - it's File System that doesn't work on mobile, but Google appear to be working on adding support for the File System Access API on Android, so it may work in future soon. As noted the NW.js plugin is exclusively for NW.js exports and so won't work with any other export option.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, so I'm a bit rusty on the libraries, was quite sure that NW.js wasn't only desktop exports :)

    I also somehow managed to overlook the File Chooser plugin and went straight for the File System. I got this all working now on desktop and mobile without any outside tinkering.

    Thanks for the help guys!

  • Hm, I'm fairly sure I tried File Chooser years ago on mobile and it didn't work. Glad it's working now!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)