zoukankan      html  css  js  c++  java
  • 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>
    
  • 相关阅读:
    fedora 20 安裝 及 配置桌面環境
    2014上半年—Linux操作系统—嵌入式开发—中考
    【hdu 1864】最大报销额
    【hdu 1067】Gap
    【t055】成绩统计
    【b094&&z14】靶形数独
    【z06】观光公交
    【u213&&t037】修剪花卉
    【t062】最厉害的机器人
    【t075】郁闷的记者
  • 原文地址:https://www.cnblogs.com/kujisa/p/13072803.html
Copyright © 2011-2022 走看看