Suond and vibrate in background


#1

Hello!

I’m currently using background geolocation and it is working correctly, now I have to implement a vibration and a sound based on the position of the user.
But using simply the background geolocation service I’m not able to use those plugins.

Meaning, sound and vibration works while in foreground, background location works correctly, but I can’t make the phone vibrate and sound while in background.

Code:

   let config: BackgroundGeolocationConfig = {
        desiredAccuracy: 0,
        stationaryRadius: 1,
        distanceFilter: 1,
        debug: true,
        interval: 200,
        fastestInterval: 120000,
        activitiesInterval: 200,
      };

      this.backgroundGeolocation.configure(config).subscribe((location: BackgroundGeolocationResponse) => {

        this.vibration.vibrate(100);
        this.nativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing'));
        this.lat = location.latitude;
        this.lng = location.longitude;

      }, (err) => {
        console.log(err);
      });

Any hep?


#2

I’ve got a similar issue. I can’t seem to get the vibration to work while the app is in the background. Even with the native background mode package enabled the vibration doesn’t start until the the app is resumed.


#3

Any progress on this issue?


#4

To the best of my knowledge other than using local notifications to alert the user of something, this is not possible. The OS does not want apps annoying users and running their battery down, so when in the background you are limited to local notifications or push notifications.