Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWA not working on mobile Firefox #420

Open
d-reader-josip opened this issue Mar 18, 2023 · 3 comments
Open

MWA not working on mobile Firefox #420

d-reader-josip opened this issue Mar 18, 2023 · 3 comments

Comments

@d-reader-josip
Copy link

Previous discussion: #345 (comment)
This issue has been submitted in order to raise awareness and track progress (if any) on it.

Has something to do with Firefox mobile browser suspending execution the moment the browser is backgrounded

@sdlaver
Copy link
Contributor

sdlaver commented Mar 21, 2023

Can reproduce the issue. What to do about it is harder. A fix for Firefox on Android will likely rely on installing some kind of extension, that plays the same role for Mobile Wallet Adapter connections as this extension does for video playback: https://github.com/mozilla/video-bg-play

Also worth investigating: whether any of the throttling exemptions listed here would be effective: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API#policies_in_place_to_aid_background_page_performance

@d-reader-josip
Copy link
Author

d-reader-josip commented Mar 21, 2023

What about startForegroundService? https://stackoverflow.com/questions/52458942/websocket-disconnection-of-the-user-android-ios-during-the-app-in-background-a

Also, it makes sense to work out this issue even though there is only a handful of mobile firefox users. One day Chrome might add a similar policy on mobile to optimize performance which would deny MWA and require a similar fix. So best to resolve this sooner rather than later and apply a similar fix to mobile Chrome if necessary?

@Funkatronics
Copy link
Contributor

@d-reader-josip there would not be any way to start a foreground service from a webpage on Android. The webpage running in Firefox does not have access to the native Android SDK that Firefox is running on (unless Firefox provides some kind of wrapper? doubtful).

The wallet app could start a foreground service, but the webpage in Firefox would still not be able to connect to and communicate with it if Firefox is in the background.

I agree with @sdlaver that an extension running in Firefox is likely a solution. Worth investigating:

  • running a websocket in an extension background script, and see if it is paused when Firefox is backgrounded
  • the video extension that Steven linked uses a couple tricks like blocking the page visibility change events from propagating, and simulating user input to keep a video from pausing. Might be worth trying these tricks out to keep the websocket alive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants