Skip to content
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

Background refactor #222

Open
fjcaetano opened this issue Aug 12, 2016 · 8 comments
Open

Background refactor #222

fjcaetano opened this issue Aug 12, 2016 · 8 comments
Labels

Comments

@fjcaetano
Copy link
Contributor

The background worker needs to be revisited. I understand it's to create the notifications but it's absolutely draining battery.

Checking on my phone battery usage, it has consumed 83% of the battery and has been running in the background for 8.9 hours.

Isn't it possible to achieve the same using background fetch instead of location updates?

@istornz
Copy link
Owner

istornz commented Aug 12, 2016

The main problem is the restriction imposed by Apple...
When you disable location update, you can run background mode while 3 min max. The "hack" is to refresh location to let the app active.
We are currently searching a new way but it's not very simple... :/

@fjcaetano
Copy link
Contributor Author

I guess one idea is using a third party app like Boxcar or Pushover and let the server handle the notifications. It would be notified through another app, but it's a notification nonetheless

@markvl91
Copy link
Contributor

That doesn't change the fact that our app needs to fire something off to get the notifications there. This means we need a background mode that isn't as restrictive as Apple's.

A way around it is setting up a complete server which is actually capable of handling Apple Push Notifications. This is a pretty costly solution though.

@fjcaetano
Copy link
Contributor Author

Those services I mentioned allow for push to be sent to their apps by sending a simple HTTP request. So when the server detects that a pokemon that should be notified is found, it can trigger that request.

It's true that it is their app that will be notified instead of iPokeGo and the user will have to have both apps installed if he wants to receive push notifications, but it is a solution that requires no implementation in the fronted apps (iOS or Android), purely on the server side, not to mention that it is free and solves the battery problem.

@nileplumb
Copy link

I'm going to assume this is why all my data for the month got used in one day :( 1.6GB used by iPokeGo ouch

@markvl91
Copy link
Contributor

That's due to PokemonGo-Map's inefficiency. I've added delta updates to the raw_data call in my setup, this reduced data usage by nearly 100x.

@fjcaetano
Copy link
Contributor Author

Another approach to the data consumption issue: add a "WiFi only" option to the background mode.

@fjcaetano
Copy link
Contributor Author

BTW, I've requested that the servers compress the requests using gzip or some other library. For me, a request for a scan of 5 steps returns 200KB, which means that, in background, my app is consuming ~864MB/day.

Gzip averages compression at 30~40%, if I'm not mistaken, which means that data consumption could go down to 260MB (which is still a lot) without any changes in frontend clients

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants