react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

iOS background location update closed when app closed

Open sharavana006 opened this issue 9 years ago • 12 comments

  • Platform: iOS
  • OS version: 10.3
  • Device manufacturer and model:
  • React Native version: react-native-cli: 2.0.1 react-native: 0.47.2

############# Config ###############

                desiredaccuracy: 10,     
                stationaryRadius: 50,     
               distanceFilter: 50,     
               locationTimeout: 30,
                notificationTitle: 'Smart Track',
                notificationText: 'Live Tracking Enabled',
                debug: true,
                startOnBoot: true,
                stopOnTerminate: false,
                saveBatteryOnBackground: false,
                activityType: 'OtherNavigation', 
                interval: 10000,
                url: "https://www.testapps.com/ws/api/clCmAddTrack",
                syncUrl: "https://www.testapps.com/ws/api/clCmAddTrack",
                httpHeaders: {
                    'Accept': 'application/json',
                }
            });
    
           BackgroundGeolocation.on('location', (location) => {console.log(location)} );

            BackgroundGeolocation.on('stationary',(location) => {console.log('Stationary',location)} );

            BackgroundGeolocation.on('error', (error) => {
                log(' BackgroundGeolocation error:', error);
            });

            BackgroundGeolocation.start(() => {
                log('[BackgroundGeolocation started successfully');    
                callback();
            });

####################################################

Expected Behavior

After app close it should retrieve location and push it to url.

Actual Behavior

When app running in foreground or background location pushing happening properly. Once app is closed location retrieval not happening. Gps icon hidden after 5 seconds of app closed.

When running on debug mode and app in background got some push notification "## Outstanding bg-task was force-killed"

sharavana006 avatar Sep 27 '17 13:09 sharavana006

Warning: this issue has been inactive for 54 days and will be automatically closed on 2017-11-22 if there is no further activity.

mauron85 avatar Nov 21 '17 06:11 mauron85

@sharavana006 update on it ?

Furqankhanzada avatar Dec 02 '17 10:12 Furqankhanzada

Now it's working normally even after app close. Not sure what happened

sharavana06 avatar Dec 03 '17 04:12 sharavana06

@sharavana006 also working for me on IOS. will test on Android.

Furqankhanzada avatar Dec 04 '17 13:12 Furqankhanzada

@sharavana006 @mauron85 @Furqankhanzada @sharavana06 @morrislaptop I think you solved the background tracking issue. I am facing the issue in background location tracking problem in android and iOS Here are my issues: iOS:

  • when i lock the device the background geolocation is not working. there in background i am calling some api calls. When i unlock the after 15 mints all the api calls are called at a time. But it should not happen like that

  • I want to call the all the apis in background only. i.e Even when the device is lock also.

Android:

  • In Android when the the app is open all are working fine but when the app closed, i wrote a code like setInterval inside the BackgroundGeolocation.on('background',
  • In iOS this function working fine but in android this not working when the app is in background, Is there any functionality need to change for android to this module.

Below is my code, Can you please check my code and give me some suggestions, Any suggestion must be helpful.

Here is the code: https://www.dropbox.com/s/gax5hfkyps5qu9q/demo.js?dl=0

shaikhussian avatar Dec 22 '17 04:12 shaikhussian

Currently if you terminate app, location tracking is not possible on iOS. It's one of milestones for future.

mauron85 avatar Apr 02 '18 11:04 mauron85

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 28 '18 07:10 stale[bot]

@mauron85 Is stopOnTerminate working in iOS as DOC said right now ?

fokoz avatar Nov 01 '18 10:11 fokoz

How to Call Background geolocation when app is closed. in foreground it works fine. But not work when app killed/close please help me !

kameswarans avatar Dec 12 '18 11:12 kameswarans

it doesn't working when app is Terminated on IOS

imansalhi avatar Jan 13 '19 13:01 imansalhi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 12 '19 13:07 stale[bot]

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

stale[bot] avatar Jul 19 '19 14:07 stale[bot]