mauron85 / react-native-background-geolocation

Background and foreground geolocation plugin for React Native. Tracks user when app is running in background.
Apache License 2.0
1.33k stars 563 forks source link

App Freez when calling BackgroundGeolocation.stop() #487

Open arochedy opened 4 years ago

arochedy commented 4 years ago

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

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();
BabarMemon commented 4 years ago

@arochedy any success because i'm facing same issue

deedatbilla commented 4 years ago

same issue here

deveul commented 4 years ago

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

bsor-dev commented 4 years ago

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'
},
dfg31197 commented 3 years ago

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!