0

Writing JavaFX applications for Android, using GraalVM and gluon-maven-plugin:

I am trying to open a file system location using Gluon Attach (4.0.17-SNAPSHOT) BrowserService with a file: URL. That works fine on desktop systems, but fails on Android (13)

java.io.IOException: Error launching url file:/storage/emulated/0/Documents/CommLink6/logs
    at com.gluonhq.attach.browser.impl.AndroidBrowserService.launchExternalBrowser(AndroidBrowserService.java:57)
    at de.rpgframework.eden.client.jfx.EdenClientApplication.lambda$openFile$10(EdenClientApplication.java:799)

I tried file:/ and file:///

Judging from the source code it fails in a native function.

Either I am doing something wrong with the file-URL or the BrowserService is not a good choice to open file locations - but I am not aware of another options that works platform independently.

Can anyone help?

taranion
  • 631
  • 1
  • 6
  • 17
  • I took a look at the Android module, `BrowserService`, and it appears to handle URI/Web browser. Android has its own rules for [dealing with storage](https://developer.android.com/training/data-storage) which means that [the issue you commented on](https://github.com/gluonhq/attach/issues/242) is still open. – Morrison Chang Feb 20 '23 at 14:48
  • 1
    BrowserService is not for file access, indeed. However, StorageService deals with private and public folders. – José Pereda Feb 20 '23 at 16:03
  • @JoséPereda I can access the files via StorageService just fine. But I want to present the user the system file browser with a given directory. Is there another possibility to do this, if not with the BrowserService? – taranion Feb 20 '23 at 16:14
  • @MorrisonChang Oh, by the way ... I just worked around that issue today. I'll add a comment. – taranion Feb 20 '23 at 16:15
  • 1
    For a FileChooser, you will need something like this: https://github.com/gluonhq/attach/pull/283. Since that hasn't been integrated into Attach, you could give it a try as part of [AttachExtended](https://github.com/gluonhq/attachextended). – José Pereda Feb 20 '23 at 16:20
  • @JoséPereda At least on Linux and Windows there is a difference between a FileChooser and a FileBrowser. The FileChooser is used to present the user an option to select one or more files that are later processed in the application. The FileBrowser is simply an application to navigate the filesystem and view directory contents. I want to open a FileBrowser to a log or a data directory of my application. But I agree: If the BrowserService does not support file-URLs on all plattforms, there is corrently no Attach service that allows that. – taranion Feb 20 '23 at 16:31

0 Answers0