Android開發中應用選擇器中沒有自己的應用的解決方案(網頁瀏覽器)


針對網頁瀏覽器(Action.View)的方法

AndroidManifest.xmlWebActivity下添加intent-filter

正常的intent-filter是這樣的:

<intent-filter tools:ignore="AppLinkUrlError">
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http"/>
</intent-filter>

但是某些奇怪的情況下並不會顯示我們的應用。
於是需要添加其他的intent-filter確保所有情況下我們的應用都會顯示出來。

具體添加內容如下:

<intent-filter tools:ignore="AppLinkUrlError">
	<action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

<intent-filter>
	<action android:name="android.intent.action.PROCESS_TEXT" />
	<category android:name="android.intent.category.DEFAULT" />
	<data android:mimeType="text/plain" />
</intent-filter>

<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:scheme="http" />
	<data android:scheme="https" />
	<data android:scheme="about" />
	<data android:scheme="ucweb" />
	<data android:scheme="javascript" />
</intent-filter>

<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:scheme="ut.21711551" />
</intent-filter>

<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="com.UCMobile"
	    android:path="/open_my_video_window"
	    android:scheme="flyme_3dtouch"
	    tools:ignore="AppLinkUrlError" />
	<data
	    android:host="com.UCMobile"
	    android:path="/open_info_flow_channel_window"
	    android:scheme="flyme_3dtouch"
	    tools:ignore="AppLinkUrlError" />
	<data
	    android:host="com.UCMobile"
	    android:path="/open_novel_bookshelf_window"
	    android:scheme="flyme_3dtouch"
	    tools:ignore="AppLinkUrlError" />
</intent-filter>

<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.uc.cn"
	    android:pathPrefix="/cc77796ca7c25dff9607d31b29effc07"
	    android:scheme="uclink" />
</intent-filter>

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

<intent-filter
tools:ignore="AppLinkUrlError">
	<action android:name="android.intent.action.VIEW" />
	<category android:name="android.intent.category.DEFAULT" />
	<category android:name="android.intent.category.BROWSABLE" />
	<data android:mimeType="text/html" />
	<data android:mimeType="text/xml" />
	<data android:mimeType="application/xhtml+xml" />
	<data android:mimeType="application/vnd.wap.xhtml+xml" />
</intent-filter>

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

<intent-filter>
	<action android:name="android.intent.action.WEB_SEARCH" />
	<action android:name="android.intent.action.SEARCH" />
	<category android:name="android.intent.category.DEFAULT" />
	<category android:name="android.intent.category.BROWSABLE" />
	<data android:scheme="http" />
	<data android:scheme="https" />
	<data android:scheme="about" />
	<data android:scheme="ucweb" />
	<data android:scheme="javascript" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.LOADURL" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.WEBSEARCH" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.LOADBUFFER" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.INVOKE" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.OPENFILEMANAGER" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.OPENVIDEO" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.BARCODESCAN" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="com.UCMobile.intent.action.NOTIFICATION_TOOL_SETTING" />
	<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
	<action android:name="android.net.http.NETWORK_STATE" />
	<action android:name="android.intent.action.PROXY_CHANGE" />
</intent-filter>

<intent-filter>
	<category android:name="android.intent.category.DEFAULT" />
	<category android:name="android.intent.category.BROWSABLE" />
	<action android:name="android.intent.action.VIEW" />
	<data android:scheme="file" />
	<data android:scheme="content" />
	<data android:scheme="ucweb" />
	<data android:mimeType="text/html" />
	<data android:mimeType="text/xml" />
	<data android:mimeType="application/xhtml+xml" />
	<data android:mimeType="application/vnd.wap.xhtml+xml" />
	<data android:mimeType="text/css" />
</intent-filter>

<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:scheme="ftp" />
	<data android:scheme="thunder" />
	<data android:scheme="ed2k" />
	<data android:scheme="flashget" />
	<data android:scheme="magnet" />
</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" />
	<data android:scheme="file"
	    tools:ignore="AppLinkUrlError" />
	<data android:scheme="content" />
	<data android:mimeType="application/x-bttorrent" />
	<data android:pathPattern=".*\.torrent" />
</intent-filter>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM