Web clips in mobile browsers

I am working on a mobile application that should regularly test the web service (using setInterval). I made a prototype based on HTML5, but when the mobile browser goes in the background, javascript is paused.

I was looking to create my own apps for iOS and Android. In iOS, this can be done by requesting a limited amount of processing time when the application goes into the background. On Android, I assume that I will need to start the service, which will be started and stopped from the application.

However, I see that in Safari on iOS5, support for web workers has returned, and this has been supported in the Android browser for some time. This makes me wonder if I can use web workers to run javascript in mobile browsers when they are in the background?

+6
source share
1 answer

The answer is no.

Unfortunately, background applications with HTML5 technology are not suitable for mobile devices. Not only mobile browsers aggressively pause the page when it is the background, but they can also kill the entire browser (tab) if they think so. Whether or not you have web workers, this is not affected.

Running even embedded applications in the background is not trivial on these operating systems.

I suggest that you

  • Extract part of the desktop from JS and write it in your native language (Java, iOS)

  • Use Phonegap etc. similar shell for your UI application

+2
source

Source: https://habr.com/ru/post/896635/


All Articles