기존 URL
intent://{host}{path}#Intent;scheme=https;package=com.moadong.moadong;end
이 경우 앱 실행에 실패 시 안드로이드 기본 동작으로 package를 플레이스토어에어 섬색해서 보여줌. 그래서 앱이 이미 설치되어 있어도 플레이스토어 열기 화면이 떴음.
![[스크린샷 2026-02-20 오후 10.07.47.png]]
앱 실행 실패는 앱의 intent-filter 설정에 있을 수 있음
안드로이드 앱이 intent URL 받으려면 AndroidManifest.xml에 해당 URL 패턴 처리하는 intent-filter 가 등록되어 있어야 함.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="moadong.com" />
</intent-filter>
intent URL의 scheme=https와 host가 이 intent-filter와 정확히 매칭되어야 앱이 바로 열림. 매칭 안 되면 Android는 package 기반으로 플레이스토어 폴백 수행.
| 상황 | 결과 |
|---|---|
| intent-filter 매칭 성공 + 앱 설치됨 | 앱 바로 실행 |
| intent-filter 매칭 실패 + S.browser_fallback_url 없음 | Play Store에서 패키지 검색 → "열기" 표시 |
| intent-filter 매칭 실패 + S.browser_fallback | 지정한 URL(Play Store)로 리다이렉트 |
| 내가 겪은 것은 두 번째. 앱의 앱의 AndroidManifest.xml에서 intent-filter의 host나 path 패턴이 intent URL과 정확히 일치하지 않았을 가능성이 높음. |
const intentUrl =
`intent://${APP_HOST}${url.pathname}${url.search}${url.hash}` +
`#Intent;scheme=https;package=${ANDROID_PACKAGE};S.browser_fallback_url=${fallback};end`;
안드로이드는 intent://{host}{path}의 host를 기준으로 AndroidManifest.xml의 <data android:host="..."와 매칭하기 때문
우리는 RN을 쓰기에 app.json에서 intentFilter로 AndroidManifest.xml로 변환시킴
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "www.moadong.com"
}
]
}
]
Expo가 빌드할 때 내부적으로 아래와 같이 생성함.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="www.moadong.com" />
</intent-filter>
안드로이드에서는
const APP_HOST = 'www.moadong.com';
if (platform === 'Android') {
const url = new URL(currentUrl);
const fallback = encodeURIComponent(APP_STORE_LINKS.android);
const intentUrl =
`intent://${APP_HOST}${url.pathname}${url.search}${url.hash}` +
`#Intent;scheme=https;package=${ANDROID_PACKAGE};S.browser_fallback_url=${fallback};end`;
window.location.href = intentUrl;
return;
}