Promise.all().then not called in background

Hello all,

I have currently a confusing problem.

I’m using the Google Maps Plugin to rotate a Polygon. This is what my code looks like:

 private rotatePolygon(polygon: Polygon, latLngArray: ILatLng[], angle: number) {
    const pointsPromise = [];

    latLngArray.forEach((latLng: ILatLng) => {
      const point =;

    const coordsPromise = [];
    Promise.all(pointsPromise).then((results: any[]) => {[0]).then((originResult: any[]) => {
        const originPoint = {x: originResult[0], y: originResult[1]};
        results.forEach((points: number[]) => {
          const point = {x: points[0], y: points[1]};
          const rotatePoints = this.rotatePoint(point, originPoint, angle);
          const rotatedLatLng =[rotatePoints.x, rotatePoints.y]);

        Promise.all(coordsPromise).then((result: ILatLng[]) => {
          console.log("result:", result);

When the App is active, the rotation works well. But as soon as the App is in the background the Promise.all Callback is not called anymore. This happens only on Android.

Do you guys know, what I could do?

First of all, you should ask yourself, why this Promise should be executed in the background and if it’s neccessary.

But you can add a listener to your device to check your current app state, take a look here:

Maybe you should put your function (/ execution) into it.

Hope it helps.

Cheers Unkn0wn0x

The developer of the google maps plugin replied already, that it’s necessary to run the fromLatLngToPoint in the UI Thread of Android. So it won’t work in background.