Deep Linking di Mobile App
Deep linking memungkinkan URL membuka screen spesifik di app kamu — bukan hanya home screen. Ini penting untuk sharing content, email marketing, dan navigasi dari web ke app.
Tipe Deep Links
- URL Scheme — Custom protocol:
myapp://profile/123. Mudah di-setup tapi tidak unik (app lain bisa klaim scheme yang sama). - Universal Links (iOS) / App Links (Android) — HTTP URL biasa:
https://myapp.com/profile/123. OS verifikasi ownership domain, lebih aman. - Deferred Deep Link — Link yang bekerja bahkan jika app belum terinstall — redirect ke store dulu, lalu buka screen setelah install.
Setup di Expo
// app.json
{
"expo": {
"scheme": "myapp",
"ios": {
"associatedDomains": ["applinks:myapp.com"]
},
"android": {
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "myapp.com",
"pathPrefix": "/"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}
Handle Deep Links dengan Expo Router
// Expo Router otomatis handle deep links!
// URL myapp://profile/42 → app/profile/[id].tsx
// app/profile/[id].tsx
import { useLocalSearchParams } from 'expo-router';
export default function ProfileScreen() {
const { id } = useLocalSearchParams();
// id = '42' dari deep link
return <Text>Profile {id}</Text>;
}
// Handle link saat app sudah terbuka
import { useURL } from 'expo-linking';
function App() {
const url = useURL();
useEffect(() => {
if (url) {
// Parse dan navigate
const { path, queryParams } = Linking.parse(url);
router.push(path);
}
}, [url]);
}
Universal Links Verification
// Untuk Universal Links, hosting file verification:
// iOS: https://myapp.com/.well-known/apple-app-site-association
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAM_ID.com.myapp.app",
"paths": ["/profile/*", "/post/*"]
}
]
}
}
// Android: https://myapp.com/.well-known/assetlinks.json
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.myapp.app",
"sha256_cert_fingerprints": ["AA:BB:CC:..."]
}
}]
Use Cases
- Email marketing — Link di email langsung buka product detail di app
- Social sharing — User share link, penerima buka langsung di app
- Password reset — Email link buka form reset di app
- Referral — Referral link install app + set referrer code
- QR Code — Scan QR → buka screen spesifik