Problems with geolocation and Android 7

Hello everyone,

I made a small Ionic application a couple of years ago that uses cordova-plugin-geolocation to keep track of the position.

I use this code:

_watch = $cordovaGeolocation.watchPosition({
    timeout: 10000,
    maximumAge: 15 * 60 * 1000, // 15 minutes
    enableHighAccuracy: false
});

_watch.then(
    null,
    function (data) {
        // failure
    }, function (position) {
        // success
        _lat = position.coords.latitude;
        _lon = position.coords.longitude;
        reverseGeocoding(_lat, _lon);
    });

Everything worked until Android 7 and still works on iOS. On Android 7 it seems the watchPosition timeouts very often. I’m saying often and not always because it has been reported that sometimes the application gets the correct position (the reverseGeocoding() function is called and the name of the city is displayed on the screen). At the moment, I don’t have and Android 7 device to make some tests, but I could not reproduce the problem with a Genymotion vm with Android 7.

Could you give me some hint?

All the application uses very old releases of Ionic, Cordova and Angular, and we don’t have so much time and resources to migrate to more recent versions (we still run ionic 1 beta 14).

Thank you a lot,

Marco