GoogleChrome / android-browser-helper

The Android Browser Helper library helps developers use Custom Tabs and Trusted Web Activities on top of the AndroidX browser support library.
Apache License 2.0
699 stars 289 forks source link

Add support for Web Share Target API #66

Closed flunderpero closed 3 years ago

flunderpero commented 4 years ago

It is possible to register a PWA (WebAPK) as share target (it happens automatically if share_target is specified in manifest.json) but it does not seem to be supported in TWA at the moment. This is a huge bummer for us because share data with our PWA/TWA is a central feature.

PEConn commented 4 years ago

For context, we do have support for Share Target landed in the experimental branch (https://github.com/GoogleChrome/android-browser-helper/commit/223a17cddba56ecbdf773f39a3faa1ef5c46c8e9), the reason we then reverted it on master was because the necessary APIs hadn't made their way into androidx.browser yet.

The APIs are now in androidx.browser so adding share support should just be a matter of relanding that CL.

flunderpero commented 4 years ago

That's great news! I just discovered the commit reverting the changes (https://github.com/GoogleChrome/android-browser-helper/commit/5f6d124afa28b1693bc2f047f570656a06d057a6) just before reading your comment.

Do you have a timeline on when it will land in master and be released?

PEConn commented 4 years ago

@andreban Do you reckon it's worth adding this issue to a milestone (1.1.0 maybe?)?

andreban commented 4 years ago

Sounds good. Created a 1.2.0 milestone (1.1.0 was FocusActivity and is already out)

PEConn commented 4 years ago

Along with this, we should also merge in the immersive mode changes (https://github.com/GoogleChrome/android-browser-helper/pull/25).

flunderpero commented 4 years ago

I created a PR (#83), but still have some weird issues (see PR). Perhaps any of you could give me hint?

flunderpero commented 4 years ago

Two and a half months and a PR later and still there is no progress on this. We cannot release our app, because its main benefit is being a share-target, which works absolutely great as a PWA. But our customers demand an app (and we want to have the benefits of being listed in the Play Store).

I am a bit baffled that we seem to be the only ones desperately missing this feature.

I don't want to sound pi**ed or blame anyone for anything, but I need a perspective going forward. Had I known 2.5 months ago, that support for WebShareTargetV2 is not coming for months, I would have decided to use Cordova or write a wrapper on my own.

It would be great if you could just give me feedback, whether you plan to work on this in the next couple of weeks. I would love to help out (more), but my knowledge of the inner workings of this project and androidx is at its limit. :-)

andreban commented 4 years ago

Hey @flunderpero,

I understand your frustration and we really appreciate your effort on cherry picking the Web Share Target implementation and updating it.

I'm sorry we didn't get back sooner. The issue is not immediately obvious to us and we will need dig deeper to find out why it doesn't have the expected behaviour, which we just didn't have time to do so yet. We should have flagged this and set expectations sooner.

Web Share Target is definitely on our radar, as is locking screen orientation or starting the app in immersive mode, among other issues. But, as is usually true in software engineering, there are limited resources and we're trying to prioritise what to solve first. Your feedback and the feedback from many other developers is definitely taken into account when discussing that.

PEConn commented 4 years ago

Hey, do you mind checking if the bug still occurs on Chrome Canary 86.0.4208.0 or above?

flunderpero commented 4 years ago

I just tested it with 86.0.4208.3 and all's still the same.

PEConn commented 4 years ago

Ah damnit, I'd hoped that https://chromium-review.googlesource.com/c/chromium/src/+/2302759 had fixed it.

Oh well, I'll dig further.

On Thu, 23 Jul 2020 at 14:05, Peter Romianowski notifications@github.com wrote:

I just tested it with 86.0.4208.3 and all's still the same.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GoogleChrome/android-browser-helper/issues/66#issuecomment-662994579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4LBZNNESVCQBO6LZEVQC3R5AYQTANCNFSM4KU3JYAQ .

greyGuy11 commented 4 years ago

Is there any schedule for share target? I'm so missing this feature.

mvano commented 4 years ago

This has basically landed now in #160 but there seems to be some issue that is not happening on all devices, as discussed in #83. I'd like to close that PR though, and focus the discussion in this issue. I'll try some different configurations, emulators, devices, and os versions to see if I can reproduce the issue. @flunderpero is there any exception in logcat that might be relevant?

flunderpero commented 4 years ago

I have our app with #160 working for the past week or so. Up until now I did not run into any issue regarding the WebShare Target API. That is, I am able to share content (images for the most part) with the app whether the app had been open beforehand or not. I rolled out this version to our internal test group and keep you posted. So far everything looks good!

greyGuy11 commented 4 years ago

I tried last release 2.0.1 with bubblewrap, and it still doesn't work. If I want to share simple link from browser my app doesn't appear on list to share. It works only if my app is installed as PWA.

andreban commented 4 years ago

@greyGuy11 we haven't released a Bubblewrap version that supports Web Share Target yet and it support should land in version 1.8.0. Could you try the canary version of Bubblewrap to try it out (currently, 1.8.0-alpha.1) and let us know if it works?

greyGuy11 commented 4 years ago

@andreban I just tried 1.8.0-alpha.1 and unfortunately no difference.

andreban commented 4 years ago

Can you share the generated twa-manifest.json?

On Wed, 11 Nov 2020, 17:42 greyGuy11, notifications@github.com wrote:

@andreban https://github.com/andreban I just tried 1.8.0-alpha.1 and unfortunately no difference.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleChrome/android-browser-helper/issues/66#issuecomment-725563243, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANHHWH5EEG62DIDL2H545DSPLEHNANCNFSM4KU3JYAQ .

greyGuy11 commented 4 years ago
{
  "packageId": "com.mydevco.myapp.twa",
  "host": "myapp.app",
  "name": "MyApp",
  "launcherName": "MyApp",
  "display": "standalone",
  "themeColor": "#FFFFFF",
  "navigationColor": "#000000",
  "navigationColorDark": "#000000",
  "navigationDividerColor": "#000000",
  "navigationDividerColorDark": "#000000",
  "backgroundColor": "#FFFFFF",
  "enableNotifications": false,
  "startUrl": "/?utm_source=pwa",
  "iconUrl": "https://myapp.app/assets/img/icons-512.png",
  "splashScreenFadeOutDuration": 300,
  "signingKey": {
    "path": "./android.keystore",
    "alias": "android"
  },
  "appVersionName": "1",
  "appVersionCode": 1,
  "shortcuts": [],
  "generatorApp": "bubblewrap-cli",
  "webManifestUrl": "https://myapp.app/manifest.json",
  "fallbackType": "customtabs",
  "features": {},
  "alphaDependencies": {
    "enabled": false
  },
  "enableSiteSettingsShortcut": true,
  "isChromeOSOnly": false,
  "orientation": "default",
  "appVersion": "1"
}

Of course there is real domain instead of myapp.app. Do you also need content of web manifest.json?

AliasIO commented 3 years ago

I'm waiting for this too, tried with 1.8.0-alpha.23 and no luck.

AliasIO commented 3 years ago

@andreban I noticed that share_target.params.files is required in manifest.json (I believe this should be optional). Adding that, shareTarget is correctly added to twa-manifest.json using @bubblewrap/cli@1.8.0.

However, after installing the app on my phone I still can't share to it. When I install the app as a PWA from Chrome, it works fine.

{
  "packageId": "com.wappalyzer.twa",
  "host": "twa.wappalyzer.com",
  "name": "Wappalyzer",
  "launcherName": "Wappalyzer",
  "display": "standalone",
  "themeColor": "#32067C",
  "navigationColor": "#000000",
  "navigationColorDark": "#000000",
  "navigationDividerColor": "#000000",
  "navigationDividerColorDark": "#000000",
  "backgroundColor": "#FFFFFF",
  "enableNotifications": false,
  "startUrl": "/?standalone=true",
  "iconUrl": "https://twa.wappalyzer.com/images/logo/icon_512.png",
  "maskableIconUrl": "https://twa.wappalyzer.com/images/logo/icon_mask_512.png",
  "monochromeIconUrl": "https://twa.wappalyzer.com/images/logo/icon_white_512.png",
  "splashScreenFadeOutDuration": 300,
  "signingKey": {
    "path": "***",
    "alias": "android"
  },
  "appVersionName": "1",
  "appVersionCode": 1,
  "shortcuts": [],
  "generatorApp": "bubblewrap-cli",
  "webManifestUrl": "https://twa.wappalyzer.com/manifest.json",
  "fallbackType": "customtabs",
  "features": {},
  "alphaDependencies": {
    "enabled": false
  },
  "enableSiteSettingsShortcut": true,
  "isChromeOSOnly": false,
  "shareTarget": {
    "action": "https://twa.wappalyzer.com/",
    "params": {
      "title": "title",
      "text": "text",
      "url": "url",
      "files": []
    }
  },
  "orientation": "default",
  "appVersion": "1"
}
andreban commented 3 years ago

This is being tracked on the Bubblewrap repo at https://github.com/GoogleChromeLabs/bubblewrap/issues/451