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

add option to sync if on WiFi only #346

Open
Strubbl opened this issue Nov 6, 2016 · 11 comments
Open

add option to sync if on WiFi only #346

Strubbl opened this issue Nov 6, 2016 · 11 comments
Labels

Comments

@Strubbl
Copy link
Contributor

Strubbl commented Nov 6, 2016

With all the automatic sync options (and the image sync coming in future), i would love to see an option in the app to synchronize only on WiFi connection and not on mobile data plan.

  1. case: maybe a general option to only ever sync on wifi
  2. case: maybe an option to sync on wifi only if the automatic syncing is active
  3. case: maybe an option to sync on wifi only if the image download is active

Which one do you think is best? Or should we go for all three (which would add a lot of complexity for sure)?

@Strubbl Strubbl changed the title add option to sync only on WiFi add option to sync if on WiFi only Nov 6, 2016
@Strubbl
Copy link
Contributor Author

Strubbl commented Nov 7, 2016

@timokau
Copy link

timokau commented Mar 17, 2017

Different usecase: I'd like to be able to sync only on a specific wifi (since the wallabag instance runs locally).
One solution would be to remove this check, which should (I hope) allow sync to be triggered by Tasker or similar apps.
That would be very flexible and easy to implement, although maybe annoying for users that don't already have Tasker or something similar installed.

@di72nn
Copy link
Member

di72nn commented Mar 18, 2017

@Eisfreak7 does any other app implement something like that? I wonder if there is a good way to do it.

@timokau
Copy link

timokau commented Mar 18, 2017

Yes, taskwarrior-android.

@Fenisu
Copy link

Fenisu commented Jun 5, 2017

What about a Sync Adapter? Wouldn't that be the optimal goal?

A "system account" for wallabag, and then let Android's Doze to manage the background sync schedules, to avoid unscheduled sync wakelocks.

@Strubbl
Copy link
Contributor Author

Strubbl commented Jun 5, 2017

@Fenisu sounds very cool. Can you support here with a pull request?

@di72nn
Copy link
Member

di72nn commented Jun 5, 2017

I considered Sync Adapter when I was implementing auto sync, but for some reason I decided not to use it. I don't remember why, so I'll probably need to look into it again.

@Fenisu
Copy link

Fenisu commented Jun 6, 2017

It might be interesting to implement it if @di72nn does not find any reason to not do it.

@di72nn
Copy link
Member

di72nn commented Jun 6, 2017

@Fenisu can you compile a list of advantages a Sync Adapter provides?

@Fenisu
Copy link

Fenisu commented Jun 10, 2017

@di72nn I'm no expert but the idea would be to avoid unnecessary "independent" wakelocks, so Android and Doze can schedule the syncs when it is better suited. From there, you can also set the network constrains you want, like sync images only from wifi. And to avoid the need of GCM to monitor changes in the server, the sync can be set up to run in intervals.

The main disadvantage is that it uses by default both account authenticator and content resolver, but it can be created as dummies to ignore them and skip changing more parts of the application.

Although it might be a good idea to move the user credentials to the corresponding part of the system instead of saving them in the shared preferences xml file.

@di72nn
Copy link
Member

di72nn commented Jun 11, 2017

The app doesn't use any explicit wakelocks (also no implicit, as far as I know). To schedule sync tasks it uses "inexact repeating" of AlarmManager, so Android system have some freedom in deciding when to run the sync tasks. It doesn't take network constraints into consideration though.

I don't plan reimplementing sync with Sync Adapter myself (at least anytime soon), but you may give it a shot.

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