java 如何从android中的URL启动android应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16396451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 22:51:06  来源:igfitidea点击:

How to launch android application from URL in android?

javaandroidurl

提问by Jayeshkumar Sojitra

Can anybody please tell me how to open android application from URL in android.

谁能告诉我如何从android中的URL打开android应用程序。

I am using following method to open application in android but it doesn't works for me.

我正在使用以下方法在 android 中打开应用程序,但它对我不起作用。

<data android:scheme="application"/>

I am passing source of URL "application://[RandomText]"

我正在传递 URL“application://[RandomText]”的来源

Is it correct way to open application?

打开应用程序的方法正确吗?

回答by Ashish Jaiswal

Try this:

试试这个:

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data android:host="www.put-your-website.com" />
    <data android:scheme="https" />
    <data android:scheme="http" />
    <data android:pathPattern=".*" />
</intent-filter>

回答by pshirishreddy

Read about BroadcastReceiver. An application must register itself to listen to intents sent using sendBroadcast(). After this the user is presented with a pop up to launch that application. (Similar to send functionality where you can choose to send using different applications)

阅读有关BroadcastReceiver 的信息。应用程序必须注册自己以侦听使用 sendBroadcast() 发送的意图。在此之后,用户将看到一个弹出窗口以启动该应用程序。(类似于发送功能,您可以选择使用不同的应用程序发送)