When we add pwa app to homescreen. Do we get two service workers then for the same site one with browser and one with native app? - progressive-web-apps

So Suppose we have a pwa app say X. When we install that app on homescreen, do we get two service workers one on browser say chrome and one in the native app? How push notifications will work in such cases, do we have to get subscription for native app separately for sending push notification to service worker of native app. And will these notifications appear in app or on chrome browser?
P.S By native app I mean pwa app installed on homescreen

Add to home screen does not add a native app to your device or desktop. It's still using browser resources. There's one service worker and one push notifications flow.

Related

Ionic 3 running in the browser: application navigates to root when switch back to Safari

I have built an Ionic 3 app which will be served in the browser (as a PWA).
I build it using ionic cordova build browser --prod, everything works as expected, but in iOS's Safari there is a strange behaviour: the app navigates between pages using the NavController's push method and the url changes, using a hash strategy, and when the user go to another app and then returns to iOS, the location from my Ionic app "reset" and the user is sent to to root.
Anyone has any idea of why this can be happening? This does not happen in Android's Chrome.
What you are experience is a known 'bug'
Maximiliano Flirtman expose that behavior for ios PWA with:
Your PWA won’t keep state between sessions, if the user gets out of a PWA, it will be restarted when coming back, so if you need the user to validate an email, SMS or do a two-factor authentication, have that in mind to offer a proper solution.
See all Maximiliano Flirtman post.

Can a PWA work in an intranet?

Lets assume that the intranet has SSL and the users are using Chrome in Android, will progressive web apps work? Will it have offline caching?
Lets assume also that the push notification service will be sitting in their network, will it also have notifications?
A Progressive Web app works where any website works, as long as it has a service worker, a manifest and SSL. When people are outside the company, they'd see the offline version.
Push notifications might work as well, but you need to be inside the company network to receive them.

Chrome Packaged Apps: Opening another app

I am wondering whether there is any JS API to start another chrome app on button click event in a chrome packaged app.
As a general rule, no, you can't invoke another app.
However, if you control both apps, you can set the second app to expect an external message.
You can add chrome.runtime.onMessageExternal listener to the second app's event page script, and send a message with the app ID from the first to wake the second app and launch the app window. See this for more details.
In general, an extension can do this task and more thanks to the management API. It is, however, unavailable for Apps as of now.
Feature request to add this API for apps: #455550

iPhone Push notifications via mobile safari

Is there a way to simulate push notifications by pushing data to mobile safari? Here are 2 scenarios.
I make a web app via phonegap and dont want to use APNS but rather make a web-socket connection and push data to the device myself. On the device end is there a "alert" function I can call to emulate a pop up when a user is not in the application?
Lets throw web app out the window. Is there a way I can do this in native mobile safari? Im not talking about a plain old JS alert window that would only come up if the user was in the app, but be able to do so with it backgrounded.
You cannot run background tasks with mobile safari so for #2 you can't do true push notifications or alerts. However you can send a user an SMS if you have the user's phone number. This can have a hyperlink to a part of your web site (which can contain some sort of payload). You can use a service such as Twilio to help you send SMS'es. However this costs money. APNS does not.
For scenario #1 I'm assuming you're talking about a native app using a phonegap solution. In this case when the app is backgrounded you cannot access any UI at all and wake up the app and show a UIAlert. In fact unless an app is registered for location updates or background music, the app is effectively not going to respond after a set period of time (it only can "finish" certain operations it had started before). So the websocket solution will only be effective if the user has the app opened.
You could register a local notification that runs at some predetermined time which will show an alert. But that is not being pushed from the server so its probably not what you want.
APNS is your best solution for scenario #1. Its not that hard to implement and its pretty inexpensive. Check out urban airship if you want to avoid building out your own server-side components for it.

How to group iphone apps under one main iphone app?

My requirement is to click one main iphone apps and the next page shows a listing of apps that provide different services. Eg. My main apps is called Company Name apps and when user clicks it open up others app like leave application apps, claim application apps etc. How do I implement that? When send to iphone app store, I only send the main apps and when user download, all the apps like leave, claim apps are also downloaded?
Once application package works as a Single Atomic Application.
com.company.application .
You can add and combine functionality of all application as classes with in one application but like .NET or Jave you can not call other applications from with in one application.
You can further add functionality with in main application which type of user has access to which feature might be some sort of profile services on your server which saves user information.
You can launch other your applications from main if you will specify in other applications URL schemes on which applications will response. For example if you will type skype://ddhhdj in your mobile Safari, than Skype will be launched.