[Android] 외부스킴

[Android] 외부스킴

1. 외부스킴

외부스킴은 모바일 브라우저에서 특정 주소를 호출하면 원하는 앱을 실행시킬 수 있는 방법이다.

모바일에 해당 앱이 설치되어 있어야 한다.

2. AndroidManifest.xml 에 외부스킴 정의

intent-filter 태그 안에 data 태그를 작성한다.

<data android:scheme=”스킴명” android:host=”호스트명” />

ex) <data android:scheme=”test” android:host=”launch” />

<!-- URL scheme -->
<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="test" android:host="launch" />
</intent-filter>

3. 모바일 브라우저에서 주소 호출

모바일 브라우저에서 아래 주소를 호출한다.

intent://호스트명#Intent;scheme=스킴명;package=패키지명;end

ex) <a href=”intent://launch#Intent;scheme=test;package=com.test.android.packageName;end”>test://launch</a>

참고사이트 : https://black-jin0427.tistory.com/99