You know when you need to import or save a file to/from an application, and it opens a smaller version of the files app, and after you select a file/directory it imports the file or saves it? Or, for example, you’re signing into google on a computer and it opens a browser where you can choose your account and sign in? Those return inputs to the app/website, right? Could it be possible to do something like that on Defold? It would be useful for saving and importing files in particular.
I think what you are asking for is a native file dialogue to select either a file or folder:
Oh thanks for this! I’m guessing that to do anything sign-in related would also require native extensions (like choosing Google account when signing in with Google or Apple, Microsoft, etc)
Yes, you probably need an extension. For which platform is this? Although I think sometimes I’ve seen software launch the sign-in process in a browser window and then somehow switch back to the app.
Yeah, that too. the browser sign in would be good for computer applications, but, for example, if you’re signing into google on Android, it just opens a “Choose Google account” screen that opened over the current application.
But is there a way to do the browser one, and even the 2nd if possible?
Those use custom URL handlers to switch between the app and a browser. The app tells your OS to open an https://
link in your default browser, then you log in on their website. Once you’re signed in, the site redirects you to a URL with a custom protocol (like x-github-desktop-auth://
for GitHub Desktop) that the app registers with your OS.
There are other cool uses too, like a multiplayer game can generate a link to your current lobby that you can send to friends and have them just click it to join.
Implementing one is different on every platform. On Linux it’s a MimeType
entry in the desktop file, on macOS (and I think iOS?) it’s the CFBundleURLTypes
section of Info.plist
, and Windows requires setting some registry keys. The caveat here is that (except for macOS) the app has to be installed somewhere to register a protocol, not just run from your downloads folder or wherever. It shouldn’t be too hard to make a library to help set this up though.
I think you can do this kind of sign in using Google Play Game Services. We already have an extension for that purpose.
Oh alright, thanks.