-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BackgoundGeolocation.on('location, ...) not being fired on android 8.1.0 #195
Comments
v0.5.0-alpha.1 is too old. Please update your plugin and try to reproduce on latest version. |
What is the newest version? When i look at releases, it says that v0.5.0-alpha.1 is last released version? EDIT: Anyway. I upgraded to .27 and still have the problem @mauron85 |
I see you're calling |
I assume it is getting called because when i allow the permission and check the android logcat, it tells me that the service has started + it logs my console.log in the on('start', ..) i'm getting this in my android logcat: 05-18 11:34:34.504 4516-4516/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.LocationService: Will start service with: Config[distanceFilter=50 stationaryRadius=50.0 desiredAccuracy=100 interval=20000 fastestInterval=5000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true locationProvider=2 nTitle=Background tracking nText=enabled nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate={"altitude":"@altitude","provider":"@Provider","bearing":"@bearing","locationProvider":"@locationProvider","latitude":"@latitude","accuracy":"@accuracy","time":"@time","radius":"@radius","speed":"@speed","longitude":"@longitude"}] 05-18 11:34:34.528 4516-4516/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.provider.RawLocationProvider: Creating RawLocationProvider |
Check if on('start') is being called and also if location services are enabled
|
The checkStatus method is getting called to early for me. |
i have the same problems its not working with API 26 if i use 23 the location updates are working as expected. |
Actually my experience is opposite to @juergengunz. With API 23 and Oreo with Activity Provider I've seen "App is using too much power" notification, but not in API 26. But I saw that one fork is trying to turn off some battery optimisations (ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) Not sure if it help your issues. but definitively you can try to add something like that guy did. mauron85/cordova-plugin-background-geolocation@master...pavelety:master EDIT: My reference to Android Marshmallow is not relevant here. It's different issue people had reported in the past - no location updates in the background. This issue is about not receiving locations at all. |
Also one more thing. All commenters please at least add "Device manufacturer and model" and "OS version" and "Plugin version" and used "Android API level" if different from original report. |
hope this helps: I am using the latest RN 0.55 Provider used: ACTIVITY_PROVIDER Tested on latest Genymotion with Tested on real Device Note: Before I updated to API 26 and used the latest release of this project, I used API 23 and an older version of this project and it worked on both simulators & real devices. I discovered a weird behavior in the simulators: If I use the settings above and execute BackgroundGeolocation.start(); it somehow breaks the simulators gps. If I open Google Maps on simulator to show the device location, it will not update the location anymore, even if I change it in the simulators... until I restart the simulator... |
The callback is delayed on iOS. |
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. |
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. |
BackgroundGeolocation.on("location", location => { BackgroundGeolocation.on("authorization", status => { this. 2 functions are not working |
same issue please reopen |
"react-native": "0.53.3",
in my build.gradle:
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
oreoEXPERIMENTAL = "yes"
}
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
oreoEXPERIMENTAL = "yes"
}
Context
The backgroundlocation is being started after i press accept in the permission dialog, but it doesn't trigger the backgroundGeolocation.on('location', ...). I don't know if this is because there are no location received, or because it just doesn't trigger.
all relevant backgroundgeolocation code:
https://gist.github.com/GillesVercammen/aba915e6e53bd9abe5ba382f15c2742d
On ios it works like it should.
Expected Behavior
User logs in --> get asked for permission --> accepts --> background location is starting / tracking toggle on --> location gets updated, on location check distance --> if distance < 500, show alert
Actual Behavior
The application ask for permission correctly, then when i press accept. The background location starts. i even get the notification that background location is enabled. The problem is that i never receive any locations, so i'm not getting into the BackgroundLocation.on('location') callback.
The application is checking the status of the background tracking before the service has actually started. Relevant code:
https://gist.github.com/GillesVercammen/77a4dd2c5e9ffffb497b5128891e137a
This is the order of function getting called in my debugged:
[INFO] App is in background
UserList.js:256 [NOTE] CHECKING THE TRACKING STATUS!!!
UserList.js:261 [NOTE] TRACKING IS NOT RUNNING
UserList.js:210 [INFO] App is in foreground
UserList.js:221 IN FOREGROUND AND STARTING
UserList.js:243 [NOTE] app is in handleAppstate and authorized, starting tracking!!!
UserList.js:250 HANDLE STATE AND STARTING
UserList.js:256 [NOTE] CHECKING THE TRACKING STATUS!!!
UserList.js:261 [NOTE] TRACKING IS NOT RUNNING
2UserList.js:186 [INFO] BackgroundGeolocation service has been started
As you can see it is checking station before the geolocation actually started running, which makes it so that my toggle is in 'off' modus, even though the app is tracking
Possible Fix
Steps to Reproduce
https://gist.github.com/GillesVercammen/aba915e6e53bd9abe5ba382f15c2742d
Context
I'm trying to track geolocation after permission was accepted on android.
Trying to track when app is in foreground and background. both not working
Debug logs
Relevant parts from printAndroidLogs or printIosLogs.
05-18 09:47:27.615 31552-31552/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.react.BackgroundGeolocationModule: App will be resumed
05-18 09:47:27.665 31552-32350/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Stopping service
05-18 09:47:27.688 31552-32351/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Starting service
05-18 09:47:27.695 31552-32353/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Stopping service
05-18 09:47:27.698 31552-32349/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.data.sqlite.SQLiteConfigurationDAO: Configuration persisted with rowId = 1
05-18 09:47:27.700 31552-32349/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Service configured with: Config[distanceFilter=50 stationaryRadius=50.0 desiredAccuracy=100 interval=10000 fastestInterval=5000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true locationProvider=2 nTitle=Background tracking nText=enabled nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate=null]
05-18 09:47:27.701 31552-32354/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Starting service
05-18 09:47:27.719 31552-32351/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.BackgroundGeolocationFacade: Starting bg service
05-18 09:47:27.765 31552-32354/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.BackgroundGeolocationFacade: Starting bg service
05-18 09:47:27.768 31552-32352/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.data.sqlite.SQLiteConfigurationDAO: Configuration persisted with rowId = 1
05-18 09:47:27.769 31552-32352/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Service configured with: Config[distanceFilter=50 stationaryRadius=50.0 desiredAccuracy=100 interval=20000 fastestInterval=5000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true locationProvider=2 nTitle=Background tracking nText=enabled nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate=null]
05-18 09:47:27.832 31552-31552/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.LocationService: Creating LocationService
05-18 09:47:27.920 31552-31552/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Binding to service
05-18 09:47:27.921 31552-32357/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.LocationService: Network condition changed has connectivity: true
05-18 09:47:27.941 31552-31552/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.LocationService: Received start command startId: 1 intent: Intent { flg=0x4 cmp=be.appfoundry.digitalreceptionist.debug/com.marianhello.bgloc.LocationService (has extras) }
05-18 09:47:28.043 31552-31552/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.LocationService: Will start service with: Config[distanceFilter=50 stationaryRadius=50.0 desiredAccuracy=100 interval=20000 fastestInterval=5000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true locationProvider=2 nTitle=Background tracking nText=enabled nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate={"altitude":"@altitude","provider":"@Provider","bearing":"@bearing","locationProvider":"@locationProvider","latitude":"@latitude","accuracy":"@accuracy","time":"@time","radius":"@radius","speed":"@speed","longitude":"@longitude"}]
05-18 09:47:28.060 31552-31552/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.provider.RawLocationProvider: Creating RawLocationProvider
05-18 09:47:28.080 31552-31552/be.appfoundry.digitalreceptionist.debug I/AudioTrack: AUDIO_OUTPUT_FLAG_FAST successful; frameCount 960 -> 960
05-18 09:47:28.080 31552-31552/be.appfoundry.digitalreceptionist.debug D/AudioTrack: Client defaulted notificationFrames to 192 for frameCount 960
05-18 09:47:28.094 31552-31552/be.appfoundry.digitalreceptionist.debug W/Notification: Use of stream types is deprecated for operations other than volume control
05-18 09:47:28.094 31552-31552/be.appfoundry.digitalreceptionist.debug W/Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
05-18 09:47:28.097 31552-31552/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.BackgroundGeolocationFacade: Binding to service
05-18 09:47:28.119 31552-31552/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.LocationService: Received start command startId: 2 intent: Intent { flg=0x4 cmp=be.appfoundry.digitalreceptionist.debug/com.marianhello.bgloc.LocationService (has extras) }
05-18 09:47:28.131 31552-31552/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.provider.RawLocationProvider: Destroying RawLocationProvider
05-18 09:47:28.147 31552-31552/be.appfoundry.digitalreceptionist.debug D/com.marianhello.bgloc.LocationService: Will start service with: Config[distanceFilter=50 stationaryRadius=50.0 desiredAccuracy=100 interval=20000 fastestInterval=5000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true locationProvider=2 nTitle=Background tracking nText=enabled nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate={"altitude":"@altitude","provider":"@Provider","bearing":"@bearing","locationProvider":"@locationProvider","latitude":"@latitude","accuracy":"@accuracy","time":"@time","radius":"@radius","speed":"@speed","longitude":"@longitude"}]
05-18 09:47:28.161 31552-31552/be.appfoundry.digitalreceptionist.debug I/com.marianhello.bgloc.provider.RawLocationProvider: Creating RawLocationProvider
05-18 09:47:28.174 31552-31552/be.appfoundry.digitalreceptionist.debug I/AudioTrack: AUDIO_OUTPUT_FLAG_FAST successful; frameCount 960 -> 960
05-18 09:47:28.174 31552-31552/be.appfoundry.digitalreceptionist.debug D/AudioTrack: Client defaulted notificationFrames to 192 for frameCount 960
EDIT:
updates plugin version
The text was updated successfully, but these errors were encountered: