Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.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
Java 如何在android中使用深度链接_Java_Android_Deep Linking - Fatal编程技术网

Java 如何在android中使用深度链接

Java 如何在android中使用深度链接,java,android,deep-linking,Java,Android,Deep Linking,在我的应用程序中,我希望在我的应用程序中使用深层链接来打开URL。 我写了以下代码,但当单击URL时,请在浏览器中打开此URL,而不是在我的应用程序中打开。 我的清单代码: <activity android:name=".activity.PostDetailsActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:s

在我的应用程序中,我希望在我的应用程序中使用深层链接来打开URL。
我写了以下代码,但当单击URL时,请在浏览器中打开此URL,而不是在我的应用程序中打开。

我的清单代码:

<activity
    android:name=".activity.PostDetailsActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:screenOrientation="sensorPortrait"
    android:theme="@style/DetailsActivityTheme" >
    <!-- DeepLink -->
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="www.example.ir"
            android:pathPrefix="/*"
            android:scheme="http" />
        <data
            android:host="example.ir"
            android:pathPrefix="/*"
            android:scheme="http" />
    </intent-filter>

</activity>
我的url:
http://example.ir/2018/06/24/content_title_url


如何解决此问题并打开我的应用程序?

在您的menidfest中添加主机android:host=“example.ir”而不是android:host=“www.example.ir”@ShwetaChauhan,请查看我的上述代码。我写下每个主机名,example.ir和www.example.ir。但对我来说也不是工作!你能帮我更多吗?请相信我最近完成了这项任务。与firebase深度链接。@ShwetaChauhan,firebase在我的国家受到抵制:(@ShwetaChauhan,为什么不使用我的代码?
Intent intent2 = getIntent();
Uri data = intent2.getData();
if (data!=null){
    Toast.makeText(mActivity, ""+data, Toast.LENGTH_SHORT).show();
}