bug: android appUrlOpen never fires
See original GitHub issueBug Report
Capacitor Version
๐ Capacitor Doctor ๐
Latest Dependencies:
@capacitor/cli: 2.2.0
@capacitor/core: 2.2.0
@capacitor/android: 2.2.0
@capacitor/electron: 2.2.0
@capacitor/ios: 2.2.0
Installed Dependencies:
@capacitor/electron not installed
@capacitor/cli 2.2.0
@capacitor/core 2.2.0
@capacitor/android 2.2.0
@capacitor/ios 2.2.0
[success] Android looking great! ๐
Found 16 Capacitor plugins for ios:
call-number (1.0.1)
cordova-open-native-settings (1.5.2)
cordova-plugin-calendar (5.1.5)
cordova-plugin-device-motion (2.0.1)
cordova-plugin-email-composer (0.9.2)
cordova-plugin-file (6.0.2)
cordova-plugin-nativegeocoder (3.4.1)
cordova-plugin-screen-orientation (3.0.2)
cordova-plugin-vibration (3.1.1)
cordova-plugin-x-socialsharing (5.6.8)
cordova-sms-plugin (1.0.0)
cordova-support-android-plugin (1.0.2)
cordova-support-google-services (1.4.1)
es6-promise-plugin (4.2.2)
phonegap-nfc (1.1.2)
phonegap-plugin-barcodescanner (8.1.0)
Platform(s)
- Android
Current Behavior
I have set up firebase dynamic links as per the docs, and all works well on IOS - the appUrlOpen listener fires and captures the link itself.
On android, the dynamic links open the app correctly, however they listener never fires and as such I cant deal with the urls.
I have set up the app association corectly and the android stuio wizard confirms this. And I have also added the intent filters as described by the capacitor docs.
https://capacitorjs.com/docs/guides/deep-links
Expected Behavior
Opening a firebase dynamic link should open the app and the listener should emit the url - or any data in fact.
Code Reproduction
App.component.ts
private initDeepLinks(): void {
if (Capacitor.isPluginAvailable('App')) {
App.getLaunchUrl()
.then((res: AppLaunchUrl) => {
console.log('APP LUANCH URL:');
console.log(res?.url);
if (!res?.url || res?.url === '') {
this.store.setKey('openedWithDynamiclink', false);
} else {
if (res?.url.includes('com.app.ping://welcome/?code')) {
this.store.setKey('openedWithDynamiclink', false);
}
this.logger.log('APP LAUNCH URL: ' + res?.url);
}
})
App.addListener('appUrlOpen', (data: any) => {
console.log('APP URL OPENED VEENT URL:');
console.log(data?.url);
Browser.close()
.then()
.catch(err => {
console.error(err);
})
if (data?.url && data?.url !== '') {
this.logger.log('APP OPENED WITH URL: ' + data?.url);
this.deeplinks.consumeDynamicLink(data.url);
}
});
}
}
}
Activity - Android manifest:
` ``` <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:name="com.app.ping.MainActivity" android:label="@string/title_activity_main" android:theme="@style/AppTheme.NoActionBarLaunch" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="@string/custom_url_scheme"
android:host="open" />
</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="pingapp.page.link" />
<data
android:scheme="http"
android:host="pingapp.page.link" />
</intent-filter>
</activity>`
### Other Technical Details
`npm --version` output: 6.14.5
`node --version` output: v14.0.0
### Additional Context
- I can see the app state listener emits correctly, and on launch the applaunchUrl is correctly logged.
- Firebase.json is correctly in the project
- I followed the capacitor update guides for android
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top GitHub Comments
I can reproduce this issue on the qemu, the app got into focus after deep link from browser but since the app was already opened the callback never get called
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.