App default android.intent.action.VIEW with Zoom link Android

  Kiến thức lập trình

I have an app that intercepting links and then opening them:

<activity
    android:name=".LinkActivity"
    android:exported="true"
    android:launchMode="singleInstance">
    <intent-filter>
        <action android:name="android.intent.action.SEND"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:mimeType="text/plain"/>
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <category android:name="android.intent.category.DEFAULT" />

        <data android:scheme="http"/>
        <data android:scheme="https"/>
        <data android:host="*"/>
    </intent-filter>
</activity>

Opening the received url:

private fun openUrlWithSelfExclude(url: String) {
    val intent = Intent(Intent.ACTION_VIEW).setDataAndNormalize(url.toUri())

    val chooserIntent = Intent.createChooser(intent, title).apply {
        // Exclude our activity from being shown
        putExtra(Intent.EXTRA_EXCLUDE_COMPONENTS, arrayOf(ComponentName(applicationContext, LinkActivity::class.java)))
        flags = Intent.FLAG_ACTIVITY_NEW_TASK
    }
    startActivity(chooserIntent)
}

I’m experiencing a strange behavior, on Android 14, only for zoom links starting with:

https://us02web.zoom.us

The link is catched by zoom app:

WindowManager: Sent Transition #156 createdAt=04-16 16:56:42.154 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=75 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.VIEW dat=https://us02web.zoom.us/... flg=0x10000000 cmp=us.zoom.videomeetings/com.zipow.videobox.JoinByURLActivity } 

Then my app is catching it.

 packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY)

Returns my package when my app is not a browser.

Any ideas why my app considered as default?
How can I avoid that?

LEAVE A COMMENT