Last active
October 6, 2022 20:07
-
-
Save Sardorbekcyber/5fdc2d42e63350efd0bebb43b08ab540 to your computer and use it in GitHub Desktop.
Deeplinks Info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#If users are clicking on links and they aren’t opening in your application, | |
#then there might be a problem with your intent-filters. You can test your | |
#intent-filters using the command adb shell am start with a VIEW action, a deep linked URL, | |
#and the package id. This checks that the application can handle a deep link which is explicitly sent to it. | |
adb shell am start \ | |
-W -a android.intent.action.VIEW \ | |
-d "https://droidfood.example.com" \ | |
com.example.droidfood | |
<intent-filter android:autoVerify="true"> | |
<action android:name="android.intent.action.VIEW" /> | |
<category android:name="android.intent.category.DEFAULT" /> | |
<category android:name="android.intent.category.BROWSABLE" /> | |
<!-- If a user clicks on a shared link that uses the "http" scheme, your | |
app should be able to delegate that traffic to "https". --> | |
<data android:scheme="http" /> | |
<data android:scheme="https" /> | |
<!-- Include one or more domains that should be verified. --> | |
<data android:host="droidfood.example.com" /> | |
</intent-filter> | |
adb shell am start \ | |
-W -a android.intent.action.VIEW \ | |
-d "https://droidfood.example.com" | |
# Do not specify the Android package name | |
adb shell pm verify-app-links -- re-verify | |
forces the Android operating system to verify the site association between the application and the web host. This is an asynchronous command and may take a few minutes for its work to be completed. | |
adb shell pm get-app-links | |
lists Android App Links declared in the manifest and their verification status. | |
adb shell pm verify-app-links --re-verify com.example.droidfood; | |
adb shell pm get-app-links com.example.droidfood; | |
# Output | |
# com.example.droidfood: | |
# ID: ede4dce8-07d6-498e-95ce-5429c1d9eb96 | |
# Signatures: [F0:FD:6C:5B:41:0F:25:CB:25:C3:B5:33:46:C8:97:2F:AE:30:F8:EE:74:11:DF:91:04:80:AD:6B:2D:60:DB:83] | |
# Domain verification state: | |
# droidfood.example.com: legacy_failure | |
fun checkIsDefaultLinkHandler(): Boolean { | |
val pm = application.packageManager | |
val intent = Intent( | |
Intent.ACTION_VIEW, | |
Uri.parse("https://droidfood.example.com/about") | |
) | |
val res = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) | |
val packageName = res?.activityInfo?.packageName | |
return packageName.equals("com.example.droidfood")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment