Re: [w3c/ServiceWorker] Communicate with Native Apps (#960)

Sorry for the late answer!

At my company (we are industry-leading tire supplier and trading company in Hungary) I developed cordova-android web applications to our logistic center which apps are controlling our storekeepers to do the commissioning, stock release, arrivals and more logistic tasks. The application is working on Android phones and they are connected with hands free barcode scanners and printer via bluetooth and in some tasks with profile depth measuring device too.

In this summer I changed the application model because we developed the whole system in the warehause and we implementing detailed monitoring in everywhere. I dropped the cordova and I started to make Progressive Web Apps for each of the tasks, but I cannot entrust monitoring (wi-fi, battery, loc-tracking, etc) to a PWA, so I make the monitoring with native Android Java.

The problem is that the Monitoring/Controlling App has to give information to the PWA's and it has to start their instances (thats an other problem, which is not serviceWorker related :smile:). Because I want to make the communication between the bluetooth devices better, I wanted to use ther human interface api but in the web bluetooth thats not available (if I know right) so I have to communicate trough Native App. Thats not a bad news at all, because not every information needed on the PWA from the device. With native monitoring/controlling application I could make even better, because in some cases I need communicate directley between phones, to make the cooperative tasks smooth as possible in lie-fi and offline.

Some of the PWA's has to work with tablets and few of them has to work without any Android support on a desktop. I dont want to develop native Apps for the tasks because our buisness modell sometimes change very fast and a PWA can adapt very fast and each of our developers can modify it.

So because I want to use features what does not available in WebView (sync for example) and I have to manage communication and devices deeper than a PWA can do and the PWA purpose is just lead the storekeeper with fast as possible this complex background jobs should not run on the same place where the PWA run. Currently Im using WebView and working a bypass on a serviceWorker sync, but If in the feature a serviceWorker could open a message channel filtered by package name and a native app which in my case run in background could send messages trough I would not need any WebView and hacks to separate but make communication between this tasks. 

This channel could be usefull for example asking google fit data in a cooking PWA and this can offer recepts based on a daily calories burned without any network connection, because a data is already on the device why would I go to the network if it's not needed?

@jakearchibald Hmm, im beginner in Android, but there is no way that two native app could communicate each other on the local device? The browser which is native could make a bridge for that and thats could implement permissions what's are already in the system.

@wanderview I do not know that neather, but far as I know a native app could make a local webserver and the PWA should able to connect that. Maybe a websocket is possible too, I do not want to make only web application, I need a hybrid so I could expand my tools and use best of the both side.

@marcoscaceres That's awesome tool, I will need it but not in this projects, because in this situation I need bluetooth human interface but there is some devices which only have serial connection and now I know how will I do it without native code.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/960#issuecomment-247550549

Received on Friday, 16 September 2016 08:52:37 UTC