简体   繁体   中英

Custom URL Scheme with BroadcastReceiver not working (ERR_UKNOWN_URL_SCHEME)

I'm trying to use a custom url scheme, myapp://recv in order to receive logins. I figured I would use a BroadcastReceiver for this and an intent-filter . I went ahead and did this, but no matter what I do, I get the error ERR_UNKNOWN_URL_SCHEME . Googling showed that this used to be a Chromium bug (which has apparently been resolved), and I can't figure out how to solve this. This is my registration of the Broadcast receiver. Thanks!

<receiver
            android:name=".LoginReceiver">
            <intent-filter>
                <data android:scheme="myapp"/>
                <data android:host="recv"/>
                <data android:pathPattern=".*"/>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
        </receiver>

The issue seems to be that you can't have a URI scheme intent-filter going to a BroadcastReceiver . It must be an Activity .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM