0

So that I don't ask the wrong question, my end goal is to build a PWA that is accessible from Android 5.x and up now and iOS later in the year. The main problem with this is Classic Bluetooth is not yet stable/standardized enough for the web.

My next plan was to build a "native" app (in .NET MAUI so that I can reuse parts in iOS) using a WebView for displaying the PWA and calling back to the native app for Bluetooth. The problem here is the WebView version on the devices I have to support doesn't support PWAs, service workers, etc. (upgrading the hundred or so hardware devices is not possible, upgrading the OS is not possible, and it's pre-Android-8 so upgrading WebView is not possible without a new ROM).

Finally I've tried installing Chrome via device management and using "Chrome Custom Tabs" from MAUI. The simplest implementation works:

// Browser is <IBrowser>Microsoft.Maui.ApplicationModel.Browser.Default
await Browser.OpenAsync(
    "https://www.whatismybrowser.com/detect/what-is-my-user-agent/",
    BrowserLaunchMode.SystemPreferred);

and the tab is displayed "in" my app, however the location bar is shown within the tab: Android screenshot showing location bar in Chrome Custom Tab

Which brings me to the question:

How do I use a Chrome Custom Tab from MAUI but hide the location bar? Is this even possible?

There's little to no documentation on this for MAUI. I've tried looking through the MAUI source, but all I can see are some options:

await Browser.OpenAsync("https://www.whatismybrowser.com/detect/what-is-my-user-agent/", new BrowserLaunchOptions
{
    LaunchMode = BrowserLaunchMode.SystemPreferred, // open inside the MAUI app, i.e. Custom Tab
    TitleMode = BrowserTitleMode.Hide, // doesn't seem to have any effect
    Flags = BrowserLaunchFlags.LaunchAdjacent // the only Android flag
});

The LaunchAdjacent flag just opens "up" instead of sideways. The other flags are for iOS, detailed here. The TitleMode doesn't seem to do anything.

thinkOfaNumber
  • 2,581
  • 3
  • 27
  • 46

1 Answers1

0

Reading about Chrome Custom Tabs here, it appears it's not possible, unless I own the destination URL and setup a Trusted Web Activity. Hosting a web app combined with a native app for Bluetooth may be the only way to go if I can't use a WebView.

thinkOfaNumber
  • 2,581
  • 3
  • 27
  • 46