Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override certain URLs to launch an app or intent scheme #1344

Merged
merged 2 commits into from Feb 5, 2021

Conversation

dshokouhi
Copy link
Member

@dshokouhi dshokouhi commented Feb 3, 2021

Summary

Fixes: #569

We now accept app:// and intent:// prefix. When testing in a desktop a blank tab opens so nothing harmful appears to happen elsewhere.

When we detect that a link starts with app:// we will grab the android package and attempt to launch it, if the package does not exist we take the user to the play store (app or website)

When we detect the link starts with intent:// we will parse the Uri with the intent scheme and attempt to launch the activity, if the app is not found we will also take the user to the play store (app or website)

Examples using lovelace weblink entity card type:

This example will launch Twitter if it is installed on the device, otherwise it will open the Google Play store app or website.

- type: weblink
  name: Twitter
  url: "app://com.twitter.android"

This example will launch the barcode scanning app ready to scan via the Intent scheme, if the app is not installed the user will be directed to installing it.

- type: weblink
  name: Scan
  url: "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"

Screenshots

video: https://photos.app.goo.gl/Q93ppHcNB7u8djY97

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#450

Any other notes

…ebViewActivity.kt

Co-authored-by: Justin Bassett <bassett.justint@gmail.com>
@JBassett JBassett merged commit bd0d10d into home-assistant:master Feb 5, 2021
@dshokouhi dshokouhi deleted the webview_weblink_override branch February 25, 2021 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement ability to launch intents from app
3 participants