
<!-- IOS -->
<!-- Info.plist -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string> <!-- 사용할 스킴 (예: myapp://) -->
</array>
</dict>
</array>
myapp://product/123?ref=push
<!-- IOS -->
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// 예: myapp://product/123?ref=push
let path = url.path // "/product/123"
let query = url.query // "ref=push"
// 경로 기반으로 라우팅 처리
routeToScreen(path: path, query: query)
return true
}
useEffect(() => {
function handler() {
clearTimeout(timerRef.current);
}
// (3) window의 visibilitychange 이벤트가 발생하면 앱이 실행됐다고 가정한다. timeout을 제거한다.
window.addEventListener('visibilitychange', handler);
}, []);
const launchApp = (url: string) => {
// (1) 주어진 딥링크로 앱을 실행한다
location.href = url;
// (2) 일정한 시간동안 앱이 실행되지 않으면 특정 기능을 실행하는 timeout을 생성한다
timerRef.current = setTimeout(() => {
onLaunchFail();
}, 2000);
};
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ABCDE12345.com.example.myapp",
"paths": [ "/product/*", "/event/*" ]
}
]
}
}
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.example.myapp",
"sha256_cert_fingerprints": [
"12:34:56:...:AB:CD:EF"
]
}
}
]
applinks:myapp.com
AndroidManifest.xml에 intent-filter와 autoVerify 추가
<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="myapp.com"
android:pathPrefix="/product" />
android:pathPrefix="/event" />
</intent-filter>
앱이 설치되어 있고, 도메인 인증이 완료돼 있으면 앱 실행, 아니라면 웹 페이지로 fallback
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
guard userActivity.activityType == .BrowsingWeb,
let url = userActivity.webpageURL else { return }
let path = url.path // "/product/123"
let query = url.query // "ref=push"
routeToScreen(path: path, query: query)
}
<a href="intent://product/123#Intent;scheme=myapp;package=com.example.myapp;S.browser_fallback_url=https://myapp.com/product/123;end;">
상품 보기
</a>
https://docs.tosspayments.com/resources/glossary/deep-link
https://www.airbridge.io/ko/blog/what-is-deep-link
https://medium.com/prnd/%EB%94%A5%EB%A7%81%ED%81%AC%EC%9D%98-%EB%AA%A8%EB%93%A0%EA%B2%83-feat-app-link-universal-link-deferred-deeplink-61d6cf63a0a5
https://binux.tistory.com/172