React-native-background-geolocation: App Freez when calling BackgroundGeolocation.stop()

Created on 11 May 2020  路  5Comments  路  Source: mauron85/react-native-background-geolocation

I start using this plugin, it works well on iphone simulator but when I used it on android I have One problem : when I call BackgroundGeolocation.stop() the app freeze.

I have the same behaviour in debug and release

  • Plugin version: 0.6.3
  • Platform: Android
  • Device manufacturer and model: Honor 10

Expected Behavior

Stop follow user location

Actual Behavior

In android : everything is worikng well but when I call BackgroundGeolocation.stop(), it freez the app.

Steps to Reproduce

My config :

BackgroundGeolocation.configure({
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 50,
distanceFilter: 10,
notificationTitle: 'Background tracking',
notificationText: 'enabled',
debug: false,
startOnBoot: false,
stopOnTerminate: false,
locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
interval: 10000,
fastestInterval: 5000,
activitiesInterval: 10000,
stopOnStillActivity: false,
url: 'http://192.168.81.15:3000/location',
httpHeaders: {
'X-FOO': 'bar'
},
// customize post properties
postTemplate: {
lat: '@latitude',
lon: '@longitude',
foo: 'bar' // you can also add your own properties
}
});

  1. BackgroundGeolocation.start();
    2.BackgroundGeolocation.stop();

Most helpful comment

Make sure you have target sdk 28 and add this <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> in your AndroidManifest.xml

Set url property to null

url: 'http://192.168.81.15:3000/location', to url: null

and remove this if not necessary for your needs

httpHeaders: {
'X-FOO': 'bar'
},

All 5 comments

@arochedy any success because i'm facing same issue

same issue here

Same issue here, sometimes it freezes only the first time, and if I rerun .start(), .stop() in same app instance it may not freeze (and may freeze), android 10 but seems to be the same behaviour on simulators

Make sure you have target sdk 28 and add this <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> in your AndroidManifest.xml

Set url property to null

url: 'http://192.168.81.15:3000/location', to url: null

and remove this if not necessary for your needs

httpHeaders: {
'X-FOO': 'bar'
},

Make sure you have target sdk 28 and add this <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> in your AndroidManifest.xml

Set url property to null

url: 'http://192.168.81.15:3000/location', to url: null

and remove this if not necessary for your needs

httpHeaders: {
'X-FOO': 'bar'
},

Thanks a ton!

Was this page helpful?
0 / 5 - 0 ratings