Android之從Browser中打開本地的應用程序&微信檢測是否有對應app


在對應的應用程序的AndroidManifest.xml中配置:

<activity
            android:name=".ui.TabHostActivity"
            android:windowSoftInputMode="stateHidden|stateAlwaysHidden|adjustPan"
            android:launchMode="singleTop"
            android:screenOrientation="nosensor" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            
            <intent-filter> <!-- --> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"></category> <data android:host="www.kuyue.com" android:scheme="kuyue"></data> <!-- --> </intent-filter>
            
        </activity>

 

網頁代碼:

<a href="kuyue://www.kuyue.com">open</a>

 

1 .MAC終端查看本機ip:           ifconfig | grep inet
2 . 終端下開一個簡單服務器,適用於mac:      python -m SimpleHTTPServer
可以把帶有上面網頁代碼的Html放進一個文件中,再在終端定位到該文件夾,輸入2的命令開一個簡單的服務器用於測試,測試的時候記住第三方的瀏覽器有可能不能正確調用本地程序,請用android自帶瀏覽器進行設置。


***   顏色的代碼都可以自定義,但必須是一一對應的。

微信檢測:
微信在打開網頁的時候會在你的正確地址后面加上帶一個isappinstalled=1 (1是表示有該應用,0表示沒有 可能 沒有也會沒有這個參數)

 


免責聲明!

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



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