HaylLtd / cordova-background-geolocation-plugin

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
56 stars 64 forks source link

Application Crashes and ANRs During Extended Geolocation Usage on iOS and Android #192

Open jdevuono54 opened 3 months ago

jdevuono54 commented 3 months ago

I am experiencing a problem with my application that uses geolocation for several hours continuously (both in the foreground and background) while storing data. However, the application crashes after running for a certain period of time, and I am also encountering ANRs.

Details:

Permissions :

Plugin configuration:

options = Object.assign({
    locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
    desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
    stationaryRadius: 10,
    distanceFilter: 10,
    interval: 10000,
    stopOnTerminate: true,
    notificationIconSmall: '@mipmap/notification_icon',
    notificationTitle: this.translateService.instant('playMode.title'),
    notificationText: this.translateService.instant('misc.active'),
    startForeground: true,
    pauseLocationUpdates: false,
    url: null,
    httpHeaders: {},
    maxLocations: 10,
    postTemplate: null
}, options);

Android Vitals:

ANR 1: image

ANR 2: image2

Steps to Reproduce:

The issue is not easy to consistently reproduce. It occurs after the application has been running for several hours, making it difficult to pinpoint the exact cause.

What I've Tried:

Additional Information:

I have updated the plugin to version 2.2.1, but this update is not yet in production. Testing with this version did not yet yield conclusive results regarding the stability improvements.

Any suggestions on how to improve the stability of the application or areas to investigate would be greatly appreciated.

Thank you for your help!

HarelM commented 3 months ago

I don't think the new version has any solution to this issue. Are you deleting locations when the app returns to be top most? Looks like an sql issue, but I have no clue what is the actual exception or what might cause this... Sorry, you'll need to investigate it more.

Sqlite is used to store the location and logs.

jdevuono54 commented 3 months ago

Thank you for your response. We do not remove anything when the app comes to the foreground. We have modified the plugin to try to gather more information, but we will need to wait for a new deployment to get more insights on the issue. Additionally, we have encountered another ANR related to the plugin.

image