ionic, make android require foreground service code example

Example: ionic foreground service

import { ForegroundService } from '@ionic-native/foreground-service/ngx';


constructor(public foregroundService: ForegroundService) { }

...

startService() {
 // Notification importance is optional, the default is 1 - Low (no sound or vibration)
 this.foregroundService.start('GPS Running', 'Background Service', 'drawable/fsicon');
}

stopService() {
 // Disable the foreground service
 this.foregroundService.stop();
}

Tags:

Misc Example