從網頁(包括app中webview)打開APP

只需要在需要打開的activity標籤下添加intent-filter

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

       <category android:name="android.intent.category.BROWSABLE" />
       <category android:name="android.intent.category.DEFAULT" />
       <!-- scheme是必須的,其他的不必須 -->
       <data
            android:scheme="xiaohouzi"
            android:host="hou"
            android:sspPrefix="/123"
            android:port=""
          />
</intent-filter>

html頁面中需要超鏈接地址

<a href="xiaohouzi://hou/123">點擊打開應用</a>

這樣點擊打開應用時就會跳到註冊了的activity

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章