hippware / rn-chat

MIT License
5 stars 0 forks source link

Users location not updating when app is killed #2396

Closed mstidham closed 6 years ago

mstidham commented 6 years ago

Users location not updating

QA TEMPLATE Input
Device Type: iPhone 7 Plus
iOS: 11.3.1
tr Version: 2.6.8
Environment Production
Codepush:
Internet Connection Type: WiFi
Users affected? Miranda, Steve & Don
User handle: @miranda, @scurry & @don
Bypass handle?:
Location access type? Always
Does this issue occur on other environments? Not seeing in on Staging
Time issue occurred (UTC) 5:11 UTC

Observed Result: It appears that users are not getting location updates at times. This issue is not consistent and has not been reproduced successfully on Staging. Don, Miranda & Steve have experienced this on Production.

Issue 1: user@don was showing within bot "Home Sweet Home" although he was 10 miles from the bot. Opening the app and doing a kill/reload did not correct this issue. Deleting the app and reinstall corrected this issue.

Issue 2: user@don created a bot "Cross Timbers Construction" and received push notification when he left the bot radius but when he returned to bot location hours later he did not receive an arrival push notification or show within the bot. Opening the app usually updates the location in this case. @miranda was able to reproduce this issue.

Expected Result:

User should receive push notifications/location updates when app is in killed state.

Steps to reproduce:

  1. Leave the radius of a presence bot with app killed (should receive left push notification)
  2. Return within the presence bot with app killed and users will not receive push notification after allotted time.
  3. User opens the app and the location update is received and user will show within the bot.

    Related Screenshots/Video Links:


zavreb commented 6 years ago

@bengtan isn't this related to background fetch hack (and even that may not even solve this) due to iOS not allowing location tracking when app is suspended. Nonetheless, lets explore options.

bengtan commented 6 years ago

This ticket is a bit confusing. Let me give some information first.

1.

The client (both Staging and Prod) uses a library react-native-background-geolocation (sometimes 'rnbgl') to send location updates from the client to the server. Due to iOS and other factors, this library only sends updates when the phone is moving, or has significantly changed location.

If the phone is stationary, this library does not send updates. In fact, if the phone is stationary, the phone has to move about 200m-ish before rnbgl even wakes up (to send an update).

(Also, despite the name 'react-native-background-geolocation', it also operates when the app is in the foreground as well. But I don't think this point is significant for this ticket.)

This is enabled for both Staging and Prod, and has been in the client for a long time (ie. 2.4.x or before).

  1. Background-fetch

We are also (attempting) implementing regular periodic location updates from the client to the server, even when the phone is stationary. We refer to this as 'background-fetch' because it's using the background-fetch feature of iOS.

This one is trickier and is still in an experimental stage.

This one is enabled for (debugging for) Staging. It is not (shouldn't be?) enabled for Production.


Despite the similarities in name, they are two completely different techniques.

bengtan commented 6 years ago

As I read the ticket, I think you guys are talking about 1, not 2. But even then, it's not clear.

Observed Result: It appears that users are not getting location updates at times.

What is 'users are not getting location updates'?

The app on the device doesn't 'get' location data points from the server. It sends location data points to the server.

The only way the app can get location data points from the server is if you're using the location debugging feature (only on the Staging app).

Please clarify.

Expected Result: User should receive push notifications/location updates when app is in killed state.

Push notifications and location updates are two different things. Is this ticket about push notifications or location updates?

Please clarify.

I think maybe some more testing (or thinking) is in order, in order to disambiguate?

isn't this related to background fetch hack

If, by 'background fetch', you're referring to 2, then: No, it shouldn't be running on Prod.

But I think you're confusing 1 and 2. Please read my immediately preceding comment above.

bengtan commented 6 years ago

Oh, also, for 1, I vaguely remember that, maybe, ... background location doesn't work if the app is not in memory (ie. killed). It works if you start the app and then background it. It stops working work if you kill the app.

BUT

I think @southerneer made some change so the app 'auto-starts' so that if you kill the app, it will restart, hence, enabling background location to work.

My memory is faulty. @southerneer will have to clarify.

southerneer commented 6 years ago

Nope, didn't make any 'auto-start' changes. I'm not positive what happens with rnbgl after killing the app, but in general killing the app is a drastic step and signals to iOS that all bets are off. I wouldn't be surprised if rnbgl stops working "normally" after a kill.

aksonov commented 6 years ago

I believe we must close it - it is out of our control to support functionality after app kill

bengtan commented 6 years ago

+1 for closing ... but in my case, my reason is: 'insufficient information or clarity'.

bengtan commented 6 years ago

Came across this ticket whilst cleaning out my inbox.

After having done some work on #2508, I believe this is a duplicate of #2508.

Oh, also, for the record, the app does upload location even after an app kill.