HomeiOS Developmentandroid - Why is my React Native app generally terminated within the...

android – Why is my React Native app generally terminated within the background whereas monitoring location – RN 0.71.6


My location monitoring app works completely 88% of the time, able to recording a full day of steady location knowledge with minimal battery drain.

However about 12% of the time, the app is terminated by the OS whereas working within the background. There are not any apparent patterns relating to when the app will get terminated, however it’s normally no less than an hour or so into the monitoring session.

This occurs on each iOS and Android, and the odds are comparable.

Android

Android makes use of a customized sticky foreground service with sort: location. The app requires the Location: When In Use permission.

Important App Exit Codes are as follows:

  • REASON_SIGNALED: 13%
  • REASON_LOW_MEMORY: 18%
  • REASON_EXCESSIVE_RESOURCE_USAGE: 9%
  • REASON_OTHER: 37%

A lot of the REASON_OTHER instances have an outline like ‘Too many empty’, ‘Empty #34’ or ‘Empty for too lengthy.’ I am probably not positive what this implies.

There isn’t a apparent sample to the terminations. They even happen with Pixel gadgets, with the app’s Battery Use set to ‘Unrestricted.’

iOS

iOS makes use of a customized native module. The placement background mode is enabled for the challenge. The app requires the Location: When In Use permission.

XCode Organizer exhibits over 90% of the terminations are attributable to ‘System Strain’ which I imagine is definitely Reminiscence Strain.

I understand that requesting Location: All the time permission and utilizing the Important Location service may assist with restarting the app, however I actually do not wish to request that permission.

Looks as if a reminiscence challenge

My intuition tells me the app is holding onto an excessive amount of reminiscence within the background. The issue is, I do not know of a option to lower the reminiscence footprint. A Howdy World react native app makes use of about 200MB. My app makes use of round 300MB.

I’m questioning if ending the principle exercise on the Android facet would successfully shut down the RN portion of the app, leaving simply the native service operating. That ought to considerably cut back the reminiscence footprint.

However what could be the analogous factor to do on the iOS facet?

Anybody?

Does anybody have any recommendations on issues to attempt to both repair or higher perceive the difficulty?

Thanks.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments