Firefox OS Background services - javascript

I want to build and application through which an user can input some settings and the application will start a background service to perform some tasks based on those settings.
I want to run the application and the background service only in the Simulator (I know that it requires "certified" mode for running a background service, but I am not thinking right now for posting the app on Firefox Marketplace).
Can someone provide me with some links or tutorials on how to build and run a background service on FIrefox OS platform? Can anyone also explain how to communicate between the background service and the application? (I have search the MDN and on google, but no luck).
Also, is there some way for application (regular app or background service) to listen for notifications from a server?(I am looking for a method in which the application does not pool, but is notified by the server).
Thanks,
Tamash

Can someone provide me with some links or tutorials on how to build
and run a background service on FIrefox OS platform?
This is planned of a future version of Firefox OS. See "Background services" at https://wiki.mozilla.org/Webapi
Also, is there some way for application (regular app or background
service) to listen for notifications from a server?(I am looking for a
method in which the application does not pool, but is notified by the
server).
This doesn't seem to be implemented yet. See https://wiki.mozilla.org/Webapi and https://wiki.mozilla.org/WebAPI/SimplePush

The wiki page above is out of date - though it hints at what's coming.
Currently the RequestSync API has landed - it allows scheduled wake-ups for synchronization purposes. This is not an always-on background service. It's planned to ship in the 2.2 release of Firefox OS.
RequestSync is not yet documented on MDN but the implementation bug is here: https://bugzilla.mozilla.org/show_bug.cgi?id=1018320
RequestSync is a partial solution until we have full background synchronization through Service Workers.
Service Workers are in the implementation stage now: https://bugzilla.mozilla.org/show_bug.cgi?id=903441
Draft documentation on MDN is here:
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker_API

Related

Issues webview Android application

I make a web application using quasar and java spring boot backend. I convet my web application to an Android application using webview. But when i published in play store, its gives security issue for my backend server url. But i do not collect any data or install anything in Android apps or user device but Google gives an exception in my Android App. How can i fix this issue in Android web-view apps.
This warning is sent by Google Safe Browsing service, which is embedded in the Google Chrome Browser and several other browsers, this service looks for vulnerabilities principally in the markup; for example open tags that could lead to a code injection or other possible threats. The Safe browsing service is independent of the GCP Serverless services, this means that GCP is not marking the site as dangerous.
To prevent this message from appearing, or remove it we can do the following:
Look out for potential vulnerabilities in the app, once the changes have been made, you can use this page to see the Safe Browsing Status.
If you think that there was a mistake, you can request a review to remove the Phishing Warning in this site.
It is highly recommended to take a look a this documentation to understand what could be the reason behind the message
My issue is now fixed. It ended up being a hosting server issue. Google had me on a black list, but now its fixed.

Can a PWA app be published to app store and play store

I am creating a React JS web app which will eventually be converted to a PWA so that the users can install it on their mobile devices. Now the client ask to find out a way to push these PWA apps to apple store and google store. So my query is whether we have tools for converting the Progessive Web Apps as apk or ipa files so that we can put them to apple store or play store.
I googled a bit and is right now confused because some say it is possible, some say not possible in Apple store. I also saw some tools like PWABuilder, but I am not sure which one is the right one to use and whether we can publish a PWA app to the app store and play store.
Any help on this will be very grateful.
Thanks
While it is possible in both cases, publishing a PWA on the Apple Store is an incredible difficult journey, because Apple engineers try to build obstacles all the way long. This is by decision as Apple is making profits from its app store and PWAs would indeed subtract some of these gains. This is also the reason why Safari, as browser, is incredibly behind the other competitors in supporting PWAs APIs (PUSH API for example, as they promote their Apple Push Notification Service (APNs)).
Long story short, I would concentrate on Google Play Store, where you can publish a PWA after having wrapped it into a Trusted Web Activity (TWA), allowing Chrome (v72 or later) to run a website in fullscreen mode without a browser toolbar within an APK (Android Package). You can find further details in this tutorial to publish a PWA on the play store.
You could use Capacitor to create a native App.
It is newer than Cordova.
Here you can see the Stackoverflow TagTrend: Capacitor vs Cordova
... or wait some month. Sooner or later you will get PWAs into the Apple Store. I don't think they are able to stop this process.
I published my pwa to google play store and apple app store. I used App-bound Domains for ios and Twa for android. I think at this time to simple to publish some pwa to appstore.

Solution for identify mobile devices by mobile browser

I'm wondering it's possible to identify android device by web app running on mobile web browser? And this solution have to still working after change or upgrade web browser on this phone.
My second doubt is web app can working offline on phone showing PDF presentations saved in local storage (disk). When I have internet connection I can manually sync presentations (some are removed and some are downloaded).
If PWA app can work like I described above or in this case we need to use (hybrid) mobile app ?
PWAs allow to cache assets and make them available to the users even when they are offline. There are some functionalities that only Native Apps have (eg. access to a device contacts), but they are very close under many other aspects.
I wrote an article about Service Workers and caching strategies where I explain how to cache static assets as well as HTTP GET calls. It is part of a series about PWAs, so you might find it useful to get more insights about this technology.
Have a look at the website what web can do today to have a list of WEB APIs currently available:
I do not know the detail of your requirements, but maybe you do not even need to implement an hybrid app and simply create a PWA.

Can an offline JavaScript app using service workers work after browser restart?

Application cache as a means of creating offline browser apps has been deprecated. The current way to make an offline web app is to use service workers.
Service workers allow you to bootstrap all network requests and provide content for them. Since service worker can run even when user closes the tab, it can provide cached content when internet temporarily doesn't work.
However when I got interested in offline web applications, it was because I hoped to use even when I have permanently no access to internet. I created simple offline app, but it does not work when I close and open the browser — I get message that page cannot be loaded.
Is there a way to make service worker offline app work even after browser is closed and re-opened? If not, are there any planned standards for this? It would be very valuable to mobile users.
Can an offline JavaScript app using service workers work after browser restart?
Yes, it can, provided it's cached all of its resource previously. This example goes through the steps of ensuring that.
The reason it can is that when you navigate to the URL that the service worker is registered for, the cached copy of the service worker is activated and it's given the opportunity to satisfy network requests for the app. So if you've cached everything, and you satisfy all of the requests by handling the fetch event, your app can be entirely offline.
There is a great deal of development in the area of service workers. Chrome is taking the lead, but Firefox follows closely. IE support is negligible however.
You can see the W3C working draft. For browser support, check e.g. here.
I also suggest taking a look at Nolan Lawson's pokedex.org application, it is an offline-capable web app based on service workers.

Background Application on Smart TV

I have an application on Samsung Smart TV. I'm fetching data from web service and display this data in my application.
I'm fetching the data periodically and updating the application accordingly.
I want to run this operation as a background process, so it'll download the data and if there is an update, I warn the user when s/he watching TV.
The other thing I want is to start application on TV launch, is it possible?
Only 'ticker' type application can run in background. It is not supported in Europe and will not pass certification for Samsung Apps store.
Samsung Smart TV suppots push-notifications (samsungdforum.com/Guide/art00080/index.html).
It will allow you to show popup-message on screen with ability to launch your application.
You cannot auto-start application on TV launch.
The only way is to use custom firmware like SamyGo (http://www.samygo.tv/)
About the "background process"... as far as we assume that JavaScript's setTimeout or setInterval can be used to execute application's "internal" background process, there is no problem - Just DO it! :)
But if you were thinking about system's background process - for ex. crontab of device - it's impossible.
for your second doubt
Auto launch of the application is supported in ticker applications only and there is property in config file of the ticker widget :
"<ticker itemtype="boolean">y</ticker>"
if u mark it as y(as above) than you can set up auto launch of the app from
Menu->smart Hub->Apps settings->auto ticker. in 2014 Samsung Smart TV models.
Since Tv has limited memory I wont recommend background process like setInterval or setTimout. You may have refresh button for the same.
And They must have some js api for controlling internal method of tv application (not sure). Anyway if you really want to use interval/timeout dont forget to clear it.
As it shown here, WebSocket is supported by Samsung Smart TV. Your server application can trigger TV application when an update is appear. It is more efficient way than polling server with ajax for your case.
(Edit) I wrote a sample application to demonstrate:
https://github.com/aksakalli/socket.io-hello-world
(Edit 2) I see that your problem is about platform limits. My answer is just about approaches that can be applied then I have very limited experience on Samsung Smart TV.

Categories

Resources