How can we detect the multi-window/pop up mode in JavaScript?

Recently, my app was rejected because of this error:

Application is truncated when opened in multi-window/ pop-up view

Here is a preview of the issue:

ezgif.com-gif-maker (1)

However, I cannot find any documentation on how to detect this change with JavaScript. I cannot see any documentation in the Window API in Mozilla also. The closest I found was this question for Java:

The main challenge is, my app is a PWA created by PWABuilder; therefore, I have no access to the WebView or any extra Java/Kotlin code, and I must fix it in pure JS/CSS. Further, you don’t need PWABuilder, but the result will be alike if you do it manually since it’s creating an APK:

Shipping a PWA as an Android app - YouTube

Furthermore, this issue only happens with Samsung devices. I tested the same feature in an Oppo device, and the multi-window/popup view works perfectly. No resize troubles since the view was adapted by its internal API.

From my side, I can add an onresize event for Samsung devices only, but it may break its behavior since it won’t work as expected. It will refresh frequently if there is any resize (popup mode triggered, for example). This can become problematic since if the timer is running, it will stop, and I’ll need to figure out some crazy workaround to restore the last status. I did that with the paid app, and it is not easy to do. I don’t plan to bring this feature to this version.

Any ideas?

P.S.:

I’d advise creating a specification and sharing it with Mozilla in order to build a standard for the Window API. The closes I found was this one:

Managing several displays with the Multi-Screen Window Placement API (web.dev)

I’m quite surprised that this was never raised before because this doesn’t seem like a new topic, and the first Samsung Specification comes from 2014 (8 years ago):

Why MultiWindow was the Past, is the Present and will be the Future – Samsung Global Newsroom

Who rejected this app? Samsung Seller Portal or Google Play Store. You should get clarification from one of those first.

This seems more like an Android issue or PWABuilder issue.

I don’t think we can help you here unless another member sees this and has the workaround.

Hope you find a solution

Ron
Samsung Developer Relations

Hi Ron, it was rejected by Samsung Seller Portal. In the Play Store, I have no issues. This is the message:

But in my opinion, I’d say it’s an Android/Samsung issue since the Popup view works perfectly in the Oppo device that has the same feature. My main concern is that there is no JS API to detect when you enter that mode. How can I fix something when there is no solution that detects that change from my knowledge?

Hi Fanmixco,

I understand you can ask for further review from the seller portal 1:1 Enquiry but that is a slim chance.

I can tell you what not to do. Don’t upload it again as a different binary with the same issue hoping it will pass. They really get upset about that and can revoke a seller account.

You could ask on StackOverflow there may be some answers there.

Ron
Samsung Developer Relations

Hi Ron, there are a couple of challenges with your suggestions:

#1 My App is a containerized PWA

I just need to update the website where is getting the data and that’s all. The APK will be always the same. The app is updated based on my server app.

I added a workaround for Samsung devices that will force the resize event if there is any height/width change in the view, but if the Samsung popup view has something odd that I cannot read or know (e.g., it doesn’t notify the view that its size changed), it will be a major issue because the bug will persist.

I’d like to know if there are any specific JavaScript APIs to detect that change from the normal view to a popup view and vice-versa.

If there is no available APIs, I’d rather disable or prevent the Popup view since I cannot control what is doing because my app has thousands of downloads, and I’d like to keep it available.

If you know how to disable it, I’d be glad to know and add that code where it’s required. Also, I can remove the support in the buggy devices, but I don’t think this is a long-term solution.

#2 StackOverflow is a toxic environment for non-coding questions.

It’s not a coincidence that I came here directly. For example, I have a very precise question related to Xamarin.Android with testable code, precise problem, and there is no solution in any place, and I got negative votes in my question and answer.

Screen Shot 2022-02-12 at 20.28.41

And if you want to see how toxic is this place for asking not coding questions or trying to understand your issues, you get this kind of support from the community as soon as your try asking for support:

Screen Shot 2022-02-12 at 20.31.15

I’m quite experienced in SO to know that I’m going to start getting several -1s in less than an hour without any reply and most likely they will close it.

It’s impossible to provide any testable code from my side since there is no Window API related to Popup View in the available options. What’s more, this is Samsung-specific, I came to this forum directly since as I expressed before, it doesn’t happen in Oppo, and I couldn’t find any question related to JavaScript in StackOverflow or other forums.

I totally agree…
As Samsung Developer Relations this is highly frustrating for me. I can’t imagine how frustrating it is for you. Other developers that know the answers do not participate here and I do not know where to help you except general places.

I wish I could do more,

Ron
Samsung Developer Relations

1 Like