react-native-background-geolocation: App crash when using BackgroundGeolocation.stop()

Your Environment

  • Plugin version: 0.5.0-alpha.50
  • Platform: Android
  • OS version: any
  • Device manufacturer and model: any
  • Running in Simulator: yes
  • React Native version: 0.52.0
  • Plugin configuration options:
  • Link to your project: yes

Context

On calling

BackgroundGeolocation.stop()

app got freezed then crash after sometime

Expected Behavior

BackgroundGeolocation service should stop without any side effects

Actual Behavior

App got freezed then crash after sometime

Possible Fix

Steps to Reproduce

On calling

BackgroundGeolocation.stop()

Context

Unable to stop background geolocation service

Debug logs

2018-12-19 17:16:24.167 1641-1654/? E/ActivityManager: ANR in drivezy.admin PID: 23144 Reason: executing service drivezy.admin/com.marianhello.bgloc.service.LocationServiceImpl Load: 1.7 / 1.43 / 0.99 CPU usage from 26372ms to 0ms ago (2018-12-19 17:15:56.983 to 2018-12-19 17:16:23.355): 10% 23144/drivezy.admin: 8.4% user + 2.4% kernel / faults: 4304 minor 5.1% 1299/surfaceflinger: 0.4% user + 4.6% kernel / faults: 1 minor 4.2% 1641/system_server: 2.2% user + 1.9% kernel / faults: 4819 minor 1.4% 1343/audioserver: 0.1% user + 1.2% kernel 1% 1972/com.google.android.gms.persistent: 0.8% user + 0.2% kernel / faults: 132 minor 0.6% 1935/adbd: 0.1% user + 0.5% kernel / faults: 1145 minor 0.4% 1715/com.android.systemui: 0.2% user + 0.2% kernel / faults: 3 minor 0.3% 22405/kworker/u5:2: 0% user + 0.3% kernel 0.2% 21036/kworker/u5:0: 0% user + 0.2% kernel 0.2% 1324/dmcrypt_write: 0% user + 0.2% kernel 0.1% 1840/com.android.phone: 0% user + 0.1% kernel / faults: 2 minor 0.1% 23112/kworker/0:0: 0% user + 0.1% kernel 0.1% 563/kswapd0: 0% user + 0.1% kernel 0.1% 1336/jbd2/dm-0-8: 0% user + 0.1% kernel 0% 3/ksoftirqd/0: 0% user + 0% kernel 0% 8/rcu_preempt: 0% user + 0% kernel 0% 1242/kworker/0:1H: 0% user + 0% kernel 0% 12/ksoftirqd/1: 0% user + 0% kernel 0% 1249/logd: 0% user + 0% kernel 0% 1298/servicemanager: 0% user + 0% kernel 0% 1352/netd: 0% user + 0% kernel / faults: 63 minor 0% 1434/dhcpclient: 0% user + 0% kernel 0% 22591/com.android.vending: 0% user + 0% kernel / faults: 14 minor 10% TOTAL: 5.6% user + 3.5% kernel + 0.3% iowait + 0.4% softirq CPU usage from 303ms to 808ms later (2018-12-19 17:16:23.658 to 2018-12-19 17:16:24.163): 9.9% 1641/system_server: 7.9% user + 1.9% kernel / faults: 2593 minor 7.9% 2069/Binder:1641_8: 3.9% user + 3.9% kernel 1.9% 1648/FinalizerDaemon: 1.9% user + 0% kernel 5.7% 1935/adbd: 0% user + 5.7% kernel / faults: 572 minor 1.9% 1935/adbd: 0% user + 1.9% kernel 9% TOTAL: 4% user + 5% kernel

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 21

Most upvoted comments

Okay now I managed to solve this problem for good, the Android Gradle Plugin that I was using forced the application to use a version of Android SDK Build-Tools which was different from the one that was specified in this plugin’s documentation.

I Add on Manifest <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

and in BackgroundGeolocation.configure() add: url: null

Thanks to @rosnaib11 https://github.com/mauron85/react-native-background-geolocation/issues/487#issuecomment-651943013

Using following permission fixed it. <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />