Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android系统识别特定uri并打开特定应用程序_Android_Android Intent - Fatal编程技术网

Android系统识别特定uri并打开特定应用程序

Android系统识别特定uri并打开特定应用程序,android,android-intent,Android,Android Intent,Android系统是否可以识别特定的uri并打开特定的应用程序 示例向某人发送以开头的uritest://testing. 当用户单击它时,它将打开我的应用程序 可能吗?不知道如何实现这一点。我试着看广播接收机 我用它来检测短信,但如何让它识别自定义链接等 提前感谢您需要在清单中定义一个意向过滤器,告诉系统“我可以打开此类链接” 比如: <activity android:name=".myActivity"> ... <intent-filter>

Android系统是否可以识别特定的uri并打开特定的应用程序

示例向某人发送以开头的uritest://testing. 当用户单击它时,它将打开我的应用程序

可能吗?不知道如何实现这一点。我试着看广播接收机

我用它来检测短信,但如何让它识别自定义链接等


提前感谢

您需要在清单中定义一个意向过滤器,告诉系统“我可以打开此类链接”

比如:

<activity android:name=".myActivity">
    ...
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <!-- for test://... use "test" as sheme:  -->
        <data android:scheme="test" />

        <!-- you can also use some other parameters:  -->
        <data android:host="my.hostname.com" />
    </intent-filter>
</activity>

我认为“计划”可以做到这一点

您可以在任何其他应用程序中单击自定义url。然后用你的应用程序打开它

这里有一些有用的页面