AlanScottAgain 1 Posted May 26 Hi I'm using FB4D to access Firebase - works great. When I use my app on Android no problems. But, when it runs on iOS I get: "REST request failed: Error -1005 accessing to https://firestore.googleapis.com/v1beta1/projects/XXXXXX/databases/(default)/documents/Users/XX@XXXX.com? updateMask.fieldPaths=Last_Timer: The network connection was lost." This only happens if I allow the app to go to background. If I set SharedApplication.setIdleTimerDisabled(True); Then the app doesn't sleep and everything is fine. Obviously, when the app comes out of sleep, I check to ensure the phone is connected and it says it is, but I still get this error. I was hoping someone with a better understanding of what iOS is doing could shed some light on this. Thanks Alan Share this post Link to post
Dave Nottage 557 Posted May 26 31 minutes ago, AlanScottAgain said: Obviously, when the app comes out of sleep, I check to ensure the phone is connected and it says it is, but I still get this error. You still receive the error when the app is active? Or do you mean you receive it when the app goes into the background? (which includes the device going to sleep). iOS has very strict rules (much worse than Android) about background execution. You might want to read this. Also, you may want to consider why your app needs to access Firestore when the app is in the background, and whether it should just retry the request when the app becomes active. Share this post Link to post
AlanScottAgain 1 Posted May 26 Hi Dave, Thanks for responding. I must not have made sense. I have read that article several times and hope I'm following its recommendations: My app sets a notification and when this is activated my app is re-loaded or comes to the foreground. When it becomes active again I check the connection, Check to see if I need to refresh my login token and then post my results. It does not try to access anything whilst in the background. Interestingly, I just tested to see if a delay would make a difference and a five second delay before I attempt to save works error free, but 3 seconds does not. Does that make it any clearer? Share this post Link to post
Dave Nottage 557 Posted May 26 13 hours ago, AlanScottAgain said: It does not try to access anything whilst in the background. 14 hours ago, AlanScottAgain said: This only happens if I allow the app to go to background. 13 hours ago, AlanScottAgain said: Does that make it any clearer? Given the quotes above, no. A reproducible example might make it clearer. Share this post Link to post