Comment 4 for bug 1407709

Revision history for this message
Olivier Tilloy (osomon) wrote :

The documentation for android intent URLs (https://developer.chrome.com/multidevice/android/intents#syntax) specifies that the target app (package) is encoded in the URL fragment identifier. The host is optional, and the path is used to pass extras.

Unfortunately, URL dispatcher (https://wiki.ubuntu.com/URLDispatcher) only allows to filter on domain suffix, not fine-grained regexp matching on the entire URL. This means that as it is today, there is no way to have an app register as a handler for intent URLs that target a specific android package.

An idea that could be explored is to special-case intent:// URLs in URL dispatcher so that they are rewritten with the android package as the host. Given that the host is optional, this would in theory ensure that no important data is lost.

  intent://maps.google.es/[PATH]#Intent;scheme=http;package=com.google.android.apps.maps;end

 would be rewritten:

  intent://com.google.android.apps.maps/[PATH]#Intent;scheme=http;package=com.google.android.apps.maps;end

 thus allowing a maps application to register for such URLs with the following hook:

  [
    {
      "protocol": "intent",
      "domain-suffix": "com.google.android.apps.maps"
    }
  ]