transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.63k stars 425 forks source link

App does not send location information after closing and removing from recenlty #350

Closed doniyor2109 closed 6 years ago

doniyor2109 commented 6 years ago

Your Environment

Expected Behavior

After closing app and removing it from recently tasks, app should send location information after moving 100 meters.

Actual Behavior

Phone does not send any location information after moving 100 meters.

Steps to Reproduce

Context

Debug logs

christocracy commented 6 years ago

Have you tried this in the iOS simulator? Are you overerving logs.

Yes, it does work. You’re doing something wrong.

sirstevensu commented 6 years ago

+1

christocracy commented 6 years ago

Logs

doniyor2109 commented 6 years ago

I have tested it on Iphone 6 device also. I realized that I did not turned on Background permission to Always in Iphone settings. But when I did that it started to track but it does not track all location that phone is moved. I have attached track image in our app. It tracks correctly but you can see from image, the location between 16:14 and 16:23 is not tracked.

map1 map2jpg

christocracy commented 6 years ago

Your battery is below 50%. Your OS may have engaged power management, disabling some services.

Check your power management settings:

doniyor2109 commented 6 years ago

But as you can see from attached images battery percentages 6700% means(67%) and 6800% means (68%)

christocracy commented 6 years ago

Battery: 44%

There's really little to speculate about with images alone. You need to provide corresponding logs.

doniyor2109 commented 6 years ago

The image shows the history of location of another phone from my application. How can I get logs for you?

christocracy commented 6 years ago

See the Wiki Debugging

doniyor2109 commented 6 years ago

I have used emailLog method and this is the mailed log

background-geolocation.log.gz

doniyor2109 commented 6 years ago

I used emailLog method and this is the mailed log

background-geolocation.log.gz

christocracy commented 6 years ago

What particular time are interested in from that log?

doniyor2109 commented 6 years ago

This log is taken from android device. My phone. Today 08.11.2017, is not tracked yet.

doniyor2109 commented 6 years ago

I am interested for Today

christocracy commented 6 years ago

Is there a problem which occurred within that log?

doniyor2109 commented 6 years ago

I could not understand logs and could not find the problem

christocracy commented 6 years ago

What time in the logs corresponds to the time period where you experienced a tracking problem?

doniyor2109 commented 6 years ago

From 13:00 until 22:00

christocracy commented 6 years ago

Why are you still configuring this:

"params": {
    "auth_token": "maybe_your_server_authenticates_via_token_YES?"
  },
  "headers": {
    "X-FOO": "bar"
  },

Those are just supposed to be example data. You not actually supposed to use that.

doniyor2109 commented 6 years ago

Yes, the application is not fully on production that is why I have not refactored yet

christocracy commented 6 years ago

You have 3 days worth of logs here. 13:00-22:00 on which day?

doniyor2109 commented 6 years ago

For 08.11.2017

christocracy commented 6 years ago
11-08 13:41:05.362 INFO [HttpService createRequest] 
  πŸ”΅  HTTP POST batch (2)
11-08 13:40:43.373 WARN [HttpService$a onFailure] 
  ⚠️  Response: 0, Hostname kasper.uz not verified:
    certificate: sha256/rmLuC7tdCPlarTlIURLZKijzNi0dVp4UcylyWqmwRLs=
    DN: CN=*.wiut.uz,OU=Domain Control Validated
    subjectAltNames: [*.wiut.uz, wiut.uz]
.
.
.
11-08 13:43:01.501 WARN [HttpService$a onFailure] 
  ⚠️  Response: 0, failed to connect to kasper.uz/83.69.138.253 (port 443) after 10000ms: isConnected failed: ETIMEDOUT (Connection timed out)
.
.
.
11-08 13:43:50.925 WARN [SingleLocationRequest finish] 
  ⚠️  timeout: 1002
11-08 13:43:51.038 WARN [TSLocationManager onLocationTimeout] 
  ⚠️  TSLocationManager received location timeout
11-08 13:43:51.106 WARN [BackgroundGeolocation _onLocationError] 
  ⚠️  Location error: 408
.
.
.
11-08 13:45:22.975 WARN [SingleLocationRequest finish] 
  ⚠️  timeout: 1003
11-08 13:45:23.054 WARN [TSLocationManager onLocationTimeout] 
  ⚠️  TSLocationManager received location timeout
11-08 13:45:23.184 WARN [BackgroundGeolocation _onLocationError] 
  ⚠️  Location error: 408
.
.
.
11-08 13:51:00.925 WARN [HttpService$a onFailure] 
  ⚠️  Response: 0, Unable to resolve host "kasper.uz": No address associated with hostname
doniyor2109 commented 6 years ago

Yes, I went to study and connected to their wifi. Their proxy did not allow to access our domain.

christocracy commented 6 years ago

And mysteriously, it looks like the OS decided to terminate the background-service:

11-08 14:10:04.667 WARN [LocationService onHandleIntent] 
  ⚠️  LocationService found nobody to talk to.  Stopping...
doniyor2109 commented 6 years ago

What do you think, why it could happen?

christocracy commented 6 years ago

Memory pressure from other apps.

doniyor2109 commented 6 years ago

I have used only one application during that time. It was for chatting only. I have 2 GB RAM in my phone. It takes 300 MB of memory. There was 400 MB memory free.

doniyor2109 commented 6 years ago

What do you advice in this situation. App should track all movement of phone otherwise our clients do not use this app

christocracy commented 6 years ago

I suggest you build the SampleApp onto this device and attempt to reproduce the problem with my code on your device.

doniyor2109 commented 6 years ago

I did not understand: why my code on your device?

christocracy commented 6 years ago

Just go here and build my sample app onto your device and attempt to reproduce the problem.

doniyor2109 commented 6 years ago

I have built demo application as you told and tested today from home to work. I have installed it yesterday at night. I left home about 11:00 and arrived about 11:56 to work. As you can see through my history it did not track location between my home and work. It started tracking when I turned on internet and opened your demo application. I have posted link for my phone's bg-console. http://bg-console.herokuapp.com/1d69e670?device=ReactNative-392d2acea5650bfb&end=2017-11-9&start=2017-11-9%202%3A30

christocracy commented 6 years ago

send me the corresponding logs from SampleApp.

doniyor2109 commented 6 years ago

How can I get logs from demo app?

christocracy commented 6 years ago

See settings screen. There's an [Email Log] button along with text input for email address.

doniyor2109 commented 6 years ago

I just got my logs from demo app. Here are they background-geolocation (1).log.gz

christocracy commented 6 years ago

Try installing on another device. I think your issues are device-specific.

doniyor2109 commented 6 years ago

Hello We have tested your library on other phones recently. It works on IOS devices but it does not track sometimes however it does not work on android devices. We have installed our application to 3 android phones. They are Huawei CUN-U29, Samsung Galaxy J3 and Samsung GT 9192. their configuration were same as mentioned above. When devices are moved for longer distance, no request is coming to our server. I think the issues is not device specific.

doniyor2109 commented 6 years ago

Is there any difference with private and public library. We have used public library with licence key.

christocracy commented 6 years ago

The private version is merely latest updates.

doniyor2109 commented 6 years ago

Yes all phones had "High Accuracy" mode. Here are their logs: Samsung-I9192-background-geolocation.log.gz Samsung-Galaxy-J3-background-geolocation.log.gz Xiomi-background-geolocation.log.gz Huawei-background-geolocation.log.gz

christocracy commented 6 years ago

Samsung-I9192

Your logs show the plugin isn't even enabled. Of course that one didn't record locations

Samsung-Galaxy-J3

It does finally detect the device is in motion at:

11-20 19:24:20.637 DEBUG [BackgroundGeolocationService onActivityRecognitionResult] on_foot (94%)
11-20 19:24:26.186 DEBUG [BackgroundGeolocation isMainActivityActive] NO
11-20 19:24:26.202 INFO [BackgroundGeolocationService a] 
  πŸ”΅  setPace: false β†’ true

But when it does, HTTP Failures:

- HTTP Response failuers

11-20 19:24:27.598 WARN [HttpService$a onFailure] ⚠️ Response: 0, Unable to resolve host "kasper.uz": No address associated with hostname


### Xiomi
- Better sensors on this device:

╔═════════════════════════════════════════════ β•‘ DEVICE SENSORS ╠═════════════════════════════════════════════ β•Ÿβ”€ βœ… ACCELEROMETER: {Sensor name="LSM6DS3 Accelerometer", vendor="STMicroelectronics", version=1, type=1, maxRange=39.22661, resolution=0.0023956299, power=0.9, minDelay=5000} β•Ÿβ”€ βœ… GYROSCOPE: {Sensor name="LSM6DS3 Gyroscope", vendor="STMicroelectronics", version=1, type=4, maxRange=34.906586, resolution=0.0012207031, power=0.9, minDelay=5000} β•Ÿβ”€ βœ… MAGNETOMETER: {Sensor name="YAS537 Magnetometer", vendor="Yamaha", version=35193090, type=2, maxRange=2000.0, resolution=0.30059814, power=0.28, minDelay=10000} β•Ÿβ”€ βœ… SIGNIFICANT_MOTION: {Sensor name="Significant Motion Detector", vendor="QTI", version=2, type=17, maxRange=1.0, resolution=1.0, power=0.8999939, minDelay=-1} β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

- However, this device isn't detected to be moving *at all* though out the entire log, eg:

11-19 22:18:54.605 DEBUG [BackgroundGeolocationService onActivityRecognitionResult] still (90%)


### Huawei
- Cheap device.  Missing *Gyroscope* and *Significant Motion* sensors:

╔═════════════════════════════════════════════ β•‘ DEVICE SENSORS ╠═════════════════════════════════════════════ β•Ÿβ”€ βœ… ACCELEROMETER: {Sensor name="ACCELEROMETER", vendor="MTK", version=3, type=1, maxRange=32.0, resolution=0.00390625, power=0.13, minDelay=10000} β•Ÿβ”€ ⚠️ GYROSCOPE: none. Motion-detection system performance will be degraded β•Ÿβ”€ βœ… MAGNETOMETER: {Sensor name="MAGNETOMETER", vendor="MTK", version=3, type=2, maxRange=600.0, resolution=0.0016667, power=0.25, minDelay=100000} β•Ÿβ”€ ⚠️ SIGNIFICANT_MOTION: none. Motion-detection system performance will be degraded β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

- This device isn't moving either:

11-20 17:29:59.531 DEBUG [BackgroundGeolocationService onActivityRecognitionResult] still (100%)



You know the plugin doesn't record locations until the device is detected to be *moving*, right?
doniyor2109 commented 6 years ago

Right Here is log which I have moved my device background-geolocation.log.gz

christocracy commented 6 years ago

You have 3 days of logs in that file. What particular time interval are you interested in?

doniyor2109 commented 6 years ago

I have walked for 3 days. You can choose any of them

christocracy commented 6 years ago

I see plenty of happy tracking there.

christocracy commented 6 years ago

Let me know what time interval you're interested in.

doniyor2109 commented 6 years ago

Let's test today, from 9am untill now

doniyor2109 commented 6 years ago

Our server received only 4 requests between 23:00 and 23:50. It sent locations only when I opened application