从浏览器链接到打开我的Android应用程序

从浏览器链接到打开我的Android应用程序

问题描述:

我希望能够启动已安装的应用程序,当用户单击给定模式的URL而不是允许浏览器打开它时。这可能是用户在浏览器中的网页上。从浏览器链接到打开我的Android应用程序

例如,在手机中点击一个YouTube链接上的任何地方,你会被给予打开YouTube应用的机会,前

安装如何做到这一点我自己的应用程序吗?

在你MyLinkActivity:

String url = getIntent().getDataString(); 

在您的清单:

<activity 
    android:name=".MyLinkActivity"> 
    <intent-filter> 
     <data 
      android:host="*.myurl.com" 
      android:scheme="http" /> 
     <data 
      android:host="myurl.com" 
      android:scheme="http" /> 
     <data 
      android:host="*.myurl.com" 
      android:scheme="https" /> 
     <data 
      android:host="myurl.com" 
      android:scheme="https" /> 
                
     <category android:name="android.intent.category.DEFAULT" /> 
     <category android:name="android.intent.category.BROWSABLE" /> 
     <action android:name="android.intent.action.VIEW" />    
    </intent-filter> 
</activity> 
+1

并没有为我工作:/ – TheOnlyAnil 2015-06-09 10:06:11