2017-01-23 66 views
1

如果在應用程序上安裝了應用程序,請點擊url啓動應用程序。如果應用未安裝在設備上,請打開Playstore。如何在android中點擊url啓動應用程序

 <intent-filter> 
      <data android:scheme="app" /> 
      <action android:name="android.intent.action.VIEW" /> 

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

    </activity> 
+2

[如何在Android上實現我自己的URI方案](http:/ /stackoverflow.com/questions/2448213/how-to-implement-my-very-own-uri-scheme-on-android) – Ostin

回答

6

你必須深層鏈接您的應用程序,添加以下活動中要推出

<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="screen" android:scheme="appname"/> 
     </intent-filter> 

在瀏覽器(Manifiest.xml)線當過你點擊appname://screen您的應用程序活動將推出,

根據您的要求更換應用程序名稱和屏幕

請注意,如果您在瀏覽器中輸入此網址,它將在谷歌中搜索,爲此您必須在html頁面中編寫鏈接

+0

appname://是應用itselp。是屏幕的頁面/目錄? – SamYah

+0

例如,當用戶點擊一個鏈接時,你想在你的應用中啓動配置文件活動,那麼你的屏幕名稱應該像「配置文件」,所以它很容易理解。 – Redman

相關問題