반응형

intent filter를 설정하여 받을 수 있다.

받고자 하는 Activity에 설정.


<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="myapp"/>

</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" android:host="www.daum.net" android:pathPrefix="/"/>

</intent-filter>



custom scheme 설정과 http scheme에 대한 intent filter이다.


URL을 받기 위한 intent filter를 설정할 때에는 android.intent.category.BROWSABLE을 필히 설정해야한다.
또 한, 하나의 intent filter에는 1개의 scheme에 대한 정보만 들어가야 된다. (처음에 하나에 두가지를 같이 넣었었는데 이상 동작을 함. 심심하면 테스트 하면서 차이를 아는것도 좋은 방법일듯)


http scheme에 대한 설정을 할 경우 android:pathPrefix를 필히 설정해야 거의 모든 android폰에서 동작한다. android:host는 특정 host에 대한것만 처리하기 위해 넣을때만 필요하다.


http scheme은 삼성폰의 icecream 이상 버전에서는 동작하지 않는다. (현재로선 절대 안되니 굳이 동작하게 하려고 고민할 필요도 없다)

반응형

+ Recent posts