New issue
Advanced search Search tips

Issue 901014 link

Starred by 1 user

Issue metadata

Status: Unconfirmed
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

When user opts in on prompt to "Add to Home Screen' the 'window.appinstalled' event never fires

Reported by daviddw...@gmail.com, Nov 1

Issue description

Steps to reproduce the problem:
1. Create web app that prompts user to add app to home screen
2. create listener for 'appinstalled' on window object
3. 

What is the expected behavior?
When the app is installed the 'appinstalled' event should fire in order to direct the user to use the newly installed a2hs app

What went wrong?
Event never fires

Did this work before? N/A 

Chrome version: 70.0.3538.80  Channel: stable
OS Version: 7.0.0
Flash Version:
 
It does fire, but we are unable to redirect to the app.
Components: -Blink Blink>AppManifest
Thanks for the report. Can you elaborate on what you mean by "unable to redirect to the app"?  Perhaps a reproduction / test case would help us understand what exactly you mean?
We are trying to get a user to install our app via 'add to home screen' as
follows:

User navigates to any path on our app  (https://swipesho.weiljones.com)
Js dialog prompts user to either get native app (link to play store) or to
'add to home page'
When clicking 'add to home page' android prompt fires and app is added to
home screen
*At this point we would like to open the current url in the standalone app*

This is what I am doing right now:
On window.appinstalled I am launching another js dialog with "OPEN APP'
action.
When user clicks we do: open.window(location.protocol + '//' +
location.host + location.pathname', '_blank') in order to circumvent the
popup-blocker
This opens the app if user navigated to the root i.e
https://swipesho.weiljones.com.
However, if the path is not root chrome opens another tab :/
In the app manifest both scope and start_url are set to '/'.

Perhaps I am missing something entirely here, but the goal would be someone
clicks on a link, opens the site in chrome, clicks on 'add to home screen'
and finally gets redirected to original path in the standalone app :)
Hopefully there's a more elegant solution.

Cheers,
David
Labels: Needs-triage-Mobile
Components: Mobile>WebAPKs
Hmm. Instead of window.open could you just do a navigation of the top level window (e.g. treat is a link click). Because intent filters have changed and the navigatoin is now in scope of an installed app, I would think this would trigger our logic to then open the app

Sign in to add a comment