javaandroidandroid-permissionsandroid-deep-link

How can I check if deep links are working?


I would like to check if the app can be opened by a deep link. Im am wondering if there is a way to perform a check on apps defaults just like checking apps permissions with checkPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) .


Solution

  • What I needed to do was query the default handler for my deep link.

    PackageManager pm = getPackageManager();
    ResolveInfo resolveInfo = pm.resolveActivity("https://my.deep.link/path", PackageManager.MATCH_DEFAULT_ONLY);
    

    resolveInfo.activityInfo.packagename should return either "com.android.chrome" or "com.my.package" if my package is the default