1

Is there a method to launch a web app using adb? The web app is created using manifest.json and save on android using chrome browser. I've tried to get the package name of the web application using adb shell pm list packages but nothing seems to match. I want to launch my web app this way adb shell am start -n com.package.name/com.package.name.ActivityName

I've also tried this way adb shell am start -a android.intent.action.VIEW -d "url". This works but it is not what I am looking for.

1 Answers1

0

Assuming you are coming from Javascript world (as you could have done this by looking at adb logs), this should be what you are looking for

 adb shell am start -a com.google.android.apps.chrome.webapps.WebappManager.ACTION_START_WEBAPP -n com.android.chrome/org.chromium.chrome.browser.webapps.WebappLauncherActivity --es "org.chromium.chrome.browser.webapp_url" "{your_url}" --es "org.chromium.chrome.browser.webapp_mac" "{webapp_mac}"

Note that this url has to match the url/url-ending you have mentioned in the start_url that you have mentioned in the manifest.json of yours, else it will just open it as another chrome tab.

Another caveat here is you have to pass web app mac validation check, which is done by the core android class mentioned here - WebappAuthenticator

Chrome does not keep a store of valid URLs for installed web apps (because it cannot know when any have been uninstalled). Therefore, upon installation, it tells the Launcher a message authentication code (MAC) along with the URL for the web app, and then Chrome can verify the MAC when starting e.g. {@link #FullScreenActivity}. Chrome can thus distinguish between legitimate, installed web apps and arbitrary other URLs.

I gave it a shot to open one of the webapps I own. I gave up after a bit, getting lost in the cryptic algos. Maybe you will have some luck with it. All the best!!!

viv3k
  • 621
  • 4
  • 10