안드로이드 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.owner.test_1">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".main">
<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" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="com.example.owner.test_1" android:scheme="test_1" />
</intent-filter>
</activity>
</application>
</manifest>
HTML 구문
<HTML> <HEAD> <TITLE> App Install Check!! </TITLE> <script> function checkApplicationInstall() { document.checkframe.location = "test_1://com.example.owner.test_1"; setTimeout("checkApplicationInstall_callback()", 500); } function checkApplicationInstall_callback() { try { var s = document.checkframe.document.body.innerHTML; // 어플리케이션 설치되어있음 } catch (e) { // 어플리케이션 설치 안 되어있음 alert('app not lnstall'); document.checkframe.location = 'market://details?id=com.example.owner.test_1'; } } </script> </HEAD> <BODY onLoad="checkApplicationInstall()"> easy fax scheme call!</br> <iframe name="checkframe" width="0px" height="0px"></iframe> </BODY> </HTML>
오픈소스를 여러개 보니 거의다 이런 소스가 대부분이더라구용..
해당앱이 휴대폰에 설치되어 있으면 해당앱이 실행되며, 설치되어 있지 않다면 플레이스토어로 연결이 되어 설치하게 하는건데..
우선 HTML파일을 실행하면은 앱이 설치되어 있지만 있지 않은것처럼 catch구문으로 가서 플레이스토어로 연결이 되더군요. 서버에 넣고도 돌려보았으나 같았습니다..
스키마 네임 일치시키고 패키지명만 일치시키면 된다고 하는데 여러방면으로 시도해보았지만 잘 되지가 않네요..
QR코드로 인식하여 앱 실행해보신분 도움 부탁드립니다 ㅠ..