Ionic-Apps können Capacitor (empfohlen) oder Cordova als native Laufzeitumgebung nutzen. Die Konfiguration für Deep Linking unterscheidet sich, die URL-Verarbeitung in JavaScript bleibt aber gleich. Dieser Leitfaden behandelt beide Varianten.
Die Capacitor-spezifische Einrichtung findest du unter Capacitor Deep Linking: Einrichtung für Ionic-Apps. Einen plattformübergreifenden Überblick gibt der Leitfaden zu Cross-Platform Deep Linking für 2026.
Capacitor (empfohlen)
Capacitor ist seit Ionic 5+ die empfohlene Laufzeitumgebung für Ionic-Apps. Die vollständige Capacitor-Deep-Linking-Anleitung mit allen Details zur Einrichtung. Die Kurzfassung:
- Füge das Associated-Domains-Entitlement in Xcode hinzu (
applinks:yourdomain.com). - Füge Intent-Filter in
AndroidManifest.xml. - Hinterlege AASA und assetlinks.json auf deiner Domain.
- Nutze
@capacitor/appEreignis des PluginsappUrlOpenin JavaScript.
import { App } from '@capacitor/app';
App.addListener('appUrlOpen', (event) => {
const url = new URL(event.url);
this.router.navigateByUrl(url.pathname + url.search);
});
Cordova
Falls deine Ionic-App noch Cordova nutzt, verwende das ionic-plugin-deeplinks Plugin (oder cordova-plugin-deeplinks).
Installation
ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=yourdomain.com
Konfiguration
Das Plugin ändert die native Konfiguration automatisch:
- iOS: Fügt das Associated-Domains-Entitlement hinzu.
- Android: Fügt Intent-Filter zu
AndroidManifest.xml.
Du musst AASA und assetlinks.json trotzdem auf deiner Domain hinterlegen.
Deep Links verarbeiten (Cordova)
import { Deeplinks } from '@awesome-cordova-plugins/deeplinks/ngx';
constructor(private deeplinks: Deeplinks) {}
initializeDeepLinks() {
this.deeplinks.route({
'/products/:productId': 'ProductPage',
'/offers/:offerId': 'OfferPage',
'/referral/:referrerId': 'ReferralPage'
}).subscribe(
match => {
console.log('Deep link match:', match.$route, match.$args);
// Anhand des Treffers navigieren
this.router.navigate([match.$route], {
queryParams: match.$args
});
},
nomatch => {
console.warn('No deep link match:', nomatch.$link);
}
);
}
Migration von Cordova zu Capacitor
Wenn du von Cordova zu Capacitor migrierst:
- Entferne
ionic-plugin-deeplinks. - Befolge die Capacitor-Deep-Linking-Einrichtung.
- Ersetze die
route()API des Cordova-Plugins durchApp.addListener('appUrlOpen', ...). - Die native Konfiguration (Entitlements, Intent-Filter) muss im Capacitor-Projekt eingerichtet werden.
Ionic-Angular-Integration
Route konfigurieren
Definiere Routen, die zu deinen Deep-Link-Pfaden passen:
// app-routing.module.ts
const routes: Routes = [
{ path: '', component: HomePage },
{ path: 'products/:productId', component: ProductPage },
{ path: 'offers/:offerId', component: OfferPage },
{ path: 'referral/:referrerId', component: ReferralPage },
{ path: '**', redirectTo: '' }
];
Deep-Link-Service
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Platform } from '@ionic/angular';
import { App } from '@capacitor/app';
@Injectable({ providedIn: 'root' })
export class DeepLinkService {
constructor(
private router: Router,
private platform: Platform
) {}
async initialize() {
// Deep Links nur auf nativen Plattformen einrichten
if (!this.platform.is('capacitor')) return;
// Kaltstart
const launchUrl = await App.getLaunchUrl();
if (launchUrl?.url) {
this.handleUrl(launchUrl.url);
}
// Warmstart
App.addListener('appUrlOpen', (event) => {
this.handleUrl(event.url);
});
}
private handleUrl(urlString: string) {
try {
const url = new URL(urlString);
const path = url.pathname;
// Zum Navigieren den Angular-Router verwenden
this.router.navigateByUrl(path + url.search).catch(err => {
console.error('Navigation fehlgeschlagen:', err);
this.router.navigate(['/']);
});
} catch (e) {
console.error('Ungültige Deep-Link-URL:', urlString);
}
}
}
In der App-Komponente initialisieren
// app.component.ts
import { Component, OnInit } from '@angular/core';
import { DeepLinkService } from './services/deep-link.service';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit {
constructor(private deepLinkService: DeepLinkService) {}
ngOnInit() {
this.deepLinkService.initialize();
}
}
Ionic-React-Integration
// App.tsx
import { useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { App as CapApp } from '@capacitor/app';
import { isPlatform } from '@ionic/react';
const AppDeepLinks: React.FC = () => {
const history = useHistory();
useEffect(() => {
if (!isPlatform('capacitor')) return;
// Kaltstart
CapApp.getLaunchUrl().then(result => {
if (result?.url) {
const url = new URL(result.url);
history.push(url.pathname + url.search);
}
});
// Warmstart
const listener = CapApp.addListener('appUrlOpen', event => {
const url = new URL(event.url);
history.push(url.pathname + url.search);
});
return () => { listener.then(l => l.remove()); };
}, [history]);
return null;
};
Ionic-Vue-Integration
// composables/useDeepLinks.ts
import { onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { App } from '@capacitor/app';
import { isPlatform } from '@ionic/vue';
export function useDeepLinks() {
const router = useRouter();
let listener: any;
onMounted(async () => {
if (!isPlatform('capacitor')) return;
// Kaltstart
const launchUrl = await App.getLaunchUrl();
if (launchUrl?.url) {
const url = new URL(launchUrl.url);
router.push(url.pathname + url.search);
}
// Warmstart
listener = await App.addListener('appUrlOpen', (event) => {
const url = new URL(event.url);
router.push(url.pathname + url.search);
});
});
onUnmounted(() => {
listener?.remove();
});
}
Testen
Browser (Entwicklung)
Navigiere direkt zu Deep-Link-Pfaden:
http://localhost:8100/products/abc123
Nativ (iOS-Simulator)
xcrun simctl openurl booted "https://yourdomain.com/products/abc123"
Nativ (Android)
adb shell am start -a android.intent.action.VIEW \
-d "https://yourdomain.com/products/abc123" \
-c android.intent.category.BROWSABLE
Häufige Probleme
| Problem | Ursache | Lösung |
|---|---|---|
| Deep Links funktionieren unter Android, aber nicht unter iOS | Problem mit der AASA-Datei oder fehlendes Entitlement | Prüfe AASA und Associated Domains |
| Route nach Deep Link nicht gefunden | Angular-, React- oder Vue-Router findet die Route nicht | Prüfe, ob die Routenpfade mit den Deep-Link-Pfaden übereinstimmen |
| Funktioniert im Browser, aber nicht auf dem Gerät | Native Konfiguration fehlt | Prüfe die Entitlements (iOS) und Intent-Filter (Android) |
| Kaltstart zeigt erst Startseite, dann Navigation | Timing-Problem bei der Navigation | Launch-URL vor dem ersten Rendern verarbeiten |
Tolinku für Ionic-Apps
Tolinku stellt das Hosting für die AASA- und assetlinks.json-Dateien bereit, sodass du die Verifizierungsdateien nicht selbst verwalten musst. Das Tolinku Web SDK funktioniert mit Ionic-Apps für Smart Banner.
Für Deep Linking in React Native siehe React Native Deep Linking: vollständige Einrichtungsanleitung. Die vollständige Anleitung findest du unter Leitfaden zu Cross-Platform Deep Linking für 2026.
Deep-Linking-Tipps direkt in Ihr Postfach
Eine E-Mail pro Woche. Kein Spam.