반응형

-Android Manifest

<activity
            android:name=".Activity"
            android:label="@string/app_name"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan">

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


        </activity>

 

-Web 

 

var userAgent = navigator.userAgent; 

if(userAgent.match(".*Android.*")){
location.href = 'intent://test_web#Intent;scheme=test;package=kr.co.test;end'

}

-Android 앱으로 보낼 데이터가 있을경우

location.href = 'intent://test_web?data=0#Intent;scheme=test;package=kr.co.test;end'

 

-Android 데이터 받기

( Filter 설정한 Activity에서)

 

String data = intent.getData().getQueryParameter("data")

*앱을 종료 한 후 호출해야 데이터가 받아짐. 

그 Intent 메소드 재정의해서 사용하면 되나..?( 아직해보진 않음..  )

반응형

+ Recent posts