Hi,
I am trying to bring my Capacitor 3 + Angular app in to the foreground when receiving a data only push message. The aim is to present the user with a “Phone ringing” screen like a normal call. I have been able to code in the push messages and have them receive and process but this is all when the app is running. I have tried using cordova plugin - background mode but it causes Gradle compile errors. I’m not sure where to go next
app.module.ts
import { BackgroundMode } from '@awesome-cordova-plugins/background-mode/ngx';
....
providers: [
BackgroundMode
]
in app.component.ts
import { BackgroundMode } from '@awesome-cordova-plugins/background-mode/ngx';
....
constructor(private backgroundMode: BackgroundMode) { this.setupBackgroundListener(); }
setupBackgroundListener(): void {
this.backgroundMode.enable();
const bgModeOn = this.backgroundMode.isEnabled();
this.logger.log(`[Background Mode] Is enabled? ${bgModeOn}`);
}
...
In Gradle I see
Line 1 - Msg: Native: tried calling BackgroundMode.enable, but the BackgroundMode plugin is not installed.
Line 1 - Msg: Install the BackgroundMode plugin: 'ionic cordova plugin add cordova-plugin-background-mode'
Line 1 - Msg: Native: tried calling BackgroundMode.isEnabled, but the BackgroundMode plugin is not installed.
Line 1 - Msg: Install the BackgroundMode plugin: 'ionic cordova plugin add cordova-plugin-background-mode'