-
Notifications
You must be signed in to change notification settings - Fork 11
Open deep links externally #139
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
<queries> | ||
<!-- for supporting deep links to the maps app --> | ||
<intent> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<data android:scheme="geo" /> | ||
</intent> | ||
|
||
<!-- for supporting deep links to the messaging app --> | ||
<intent> | ||
<action android:name="android.intent.action.SENDTO" /> | ||
<data android:scheme="sms" /> | ||
</intent> | ||
</queries> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if a developer doesn't include this in their manifest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like behaviour depends on API version.
For < 11:
It sounds a bit like a free-for-all, let me do some testing...
For >= 11:
When querying for info about other apps, the system filters info. So the code wouldn't detect that there's anything able to handle the scheme, and we'd log a warning instead of launching the intent.
And the <queries>
element declares which apps you want to interact with and makes them visible. Inside queries you could also make it a specific package if you want a specific app instead of any app that can handle the intent as shown above. So, it should give quite good flexibility for clients to decide what they want to launch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth updating the warning to link to the readme, or to explain that the intent is probably missing from the manifest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested pre 11, yeah it opens up e.g. the maps, and messaging app even if the queries element is commented/missing from the manifest.
👍 I added a little more info to the README
1a1dd96
to
05fb7f1
Compare
What changes are you making?
Open deep links externally, similar to ios here - Shopify/checkout-sheet-kit-swift#227
onCheckoutLinkClicked()
queries
in its manifest to determine which links/schemes should open.How to test
Tested with a couple of links
deeplinks.mp4
Before you merge
Important
Checklist for releasing a new version
build.gradle
fileTip
See the Contributing documentation for instructions on how to publish a new version of the library.