40

Total newbie question.

Tl;dr - Can a progressive web app be registered as a share option in Android?

In Android, we can “Share” things to other installed Android apps. For example, let’s say I have Chrome for Android and the Google+ app installed on my Android device. I can share a web site which I am viewing in Chrome to Google+ by going to Chrome’s hamburger menu → Share… → Google+ (with a list of other installed native apps). Can a progressive web app be registered in this list of installed native apps? If yes, can you show me some examples or code labs? If no, is this feature in progressive web app or Android’s roadmap?

fung
  • 638
  • 6
  • 13

3 Answers3

25

Since recently a PWA can register itself as a Share target, via manifest.json.

Please read more here: https://developers.google.com/web/updates/2018/12/web-share-target

KIR
  • 5,614
  • 1
  • 31
  • 23
20

Yes. Now, you can do it on Chrome for Android from version 71+.

Assuming you have all the basics of PWA nailed down (HTTPS, registered service worker, and manifest) you only need to add the following section into your manifest.json:

  "share_target":
  {
    "action": "/share",
    "params":
    {
      "title": "title",
      "text": "text",
      "url": "url"
    }
  },

I wrote a more detailed tutorial if you get stuck at any stage.

Jakub Chodounsky
  • 597
  • 5
  • 10
-1

This has been available since Feb 2017, according to this article: https://blog.chromium.org/2017/02/integrating-progressive-web-apps-deeply.html

This works on Chrome 71+ on Android only.

You have to add this block into your PWA's manifest.json:

"share_target":
{
  "action": "/share",
  "params":
  {
    "title": "title",
    "text": "text",
    "url": "url"
  }
}
Marco
  • 11
  • 1
  • 5
  • A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](//stackoverflow.com/help/deleted-answers) – Bugs Jul 06 '17 at 07:11