Screen.show doesn't work when called from a "javascriptRequest" event in a HTMLviewer of a distributed app

Before writing a bug report, I’d like to make sure I’m using the framework in the right way.

As I understand it, we only use implicit instances on Android?

For example, if we use several screens, we don’t create these objects (and we don’t keep any reference to these screens), we use directly for example screen1.show, screen2.show, etc?

I’ve created a small test project https://melkal.com/app/testJs.zip with :

  • A Screen1 containing :

→ a “Button2” button which launches the “Screen2.Show” method.

→ an HTMLviewer. I load a little HTML/JS code into this view via the loadPage method. On this HTML page, if a link is clicked, the xojo.execute(‘openScreen2’, ‘p1’) method is launched. And in the HTMLviewer’s javascriptRequest event, we call the “Screen2.Show” method (the same as Button2)

  • A Screen2 containing just a button to close the screen.

If I run the application in an emulator (API 34, API 30…), everything works. If I run the application on my phone in debug mode via a USB cable, everything works. Which means: if I click on the “Open Screen2” link in my HTML page, Screen2 opens. If I click on button2 to open Screen2, it works too.

Now, if I build the application and download it to my phone (downloading it from my server https://melkal.com/app/testJs.apk , without going through Google Play):

→ If I click on my “Open Screen 2” link in the HTML page, screen2 doesn’t open.
→ If I click on my button2, screen2 doesn’t open.

If I relaunch the application and do the opposite: I first click on “button2”: screen2 opens. And if I now click on my link in the HTML page, screen2 opens too.

After several tests, it turns out that screen2 doesn’t open when requested in the HTMLviewer’s JavascriptRequest event in a distributed application, unless screen2 has already been opened (for example, from my Button2). Worse, if I click first on the link on my HTML page, screen2 doesn’t open, but it will also block the opening of screen2 from a code not called in an HTMLviewer (button2…

Am I missing something?

The phone I used is a modern high-end Samsung Android 14 phone. I also tried it on a Samsung tablet with the same version of Android Same result

The problem indeed seems to come from opening a view (screen, messagebox…, never opened before) in the javascriptRequest, because if I replace Screen2.Show with Button1.Caption="jsRequest ok", it works.

It works by referring to the second screen, before it opens, as var res as Boolean=screen2.Modal in screen1.opening for example, but there’s a little unsightly effect at startup.