Catfriend1 / syncthing-android

Syncthing-Fork - A Syncthing Wrapper for Android.
Mozilla Public License 2.0
2.19k stars 63 forks source link

Status tab - add button to "force start" / "force stop" #394

Closed Catfriend1 closed 5 years ago

Catfriend1 commented 5 years ago

Run conditions - Button "Sync now for 5 minutes"

frank-github commented 5 years ago

this would be a great option and very useful

Catfriend1 commented 5 years ago

The button "run now regardless of run conditions" should go to...

frank-github commented 5 years ago

Status tab or
Action within permanent Notification

Catfriend1 commented 5 years ago

This will be released shortly on GitHub (RC) and GPlay (BETA CHANNEL). Please provide feedback if it works, so we can release it to ALL users. Thank you :-).

@felixwiemuth @nelsonblaha @grwlf @sephore @ymage @rubenbe @sojusnik @vontrapp @alok0 @Mannshoch

Catfriend1 commented 5 years ago

It's there: https://github.com/Catfriend1/syncthing-android/releases/tag/rc1.2.0.7

Catfriend1 commented 5 years ago

@Zaijo : This should also solve your problem described in syncthing 1329. @mehrdadn : You can now force-start and force-stop Syncthing regardless of run conditions with one click. ref syncthing 1309.

Catfriend1 commented 5 years ago

@codethief : Hi there, could you please try and tell me if this solves your hotspot problem conveniently enough?

Zaijo commented 5 years ago

@Zaijo : This should also solve your problem described in syncthing 1329. @mehrdadn : You can now force-start and force-stop Syncthing regardless of run conditions with one click. ref syncthing 1309.

@Catfriend1 Is this going to be merged to the main repo? I'm quite lost in all these forks.

Catfriend1 commented 5 years ago

This would require the status tab (Major code change) to be merged first... I guess no at the moment. Which other forks exist in parallel? I didn't know that.

codethief commented 5 years ago

@Catfriend1: Thanks for pointing me to your fork and the feature you added here! (For future reference, the "hotspot issue" he was referring to is this one) Unfortunately, I'm new to your fork. How would I go about installing it without losing my current Syncthing-Android settings? As far as I can see, the backup option in the Android app is disabled?

On a completely different note, seeing that you're maintaining a build channel for F-Droid, how long does it typically take for the builds there to get published to F-Droid?

Catfriend1 commented 5 years ago

@codethief: In the official app, the run conditions need to be adjusted so that Syncthing runs. You'll then have the backup option available and can import your settings to STF.

F-Droid builds usually take longer, but I see no hurry why you should need the most recent wrapper version instantly. If this is exceptionally necessary, you could export your settings from the fdroid STF and e.g. run the GitHub release STF to import them. Nowadays, being one or two minor releases of the Syncthing v1.x behind isn't dramatic ;)

codethief commented 5 years ago

@codethief: In the official app, the run conditions need to be adjusted so that Syncthing runs. You'll then have the backup option available and can import your settings to STF.

I had done precisely this but after reading your message, I tried again and it turns out it takes a few seconds for the option to become available again. (Probably until Syncthing has actually fired up.) Thank you!

Also, now that I've installed your fork I gotta say I really like it! I think I'll keep on using it. Thanks for all the effort you're putting into it!

As for my original issue, I wouldn't exactly say enforcing startup is a convenient option to solve it because I still have to think of doing that manually (×) but at least it is an option to begin with, i.e. there is at least some way to work around the malfunctioning run conditions.

Any idea, though, why the "flight mode" / "run without network connection" option doesn't do the trick in my case?

(×): This is quite cumbersome in my case because I usually put my phone away when I'm at home and later have to walk back to it to fire up Syncthing. (I'm basically operating a wifi network at home which is disconnected from the internet in order to avoid distractions. The network is mainly there to synchronize files between my phone and my laptop via Syncthing, to send music to my speakers via DLNA et cetera.)

Catfriend1 commented 5 years ago

@codethief I know why it's recognizing the Hotspot. Android categorizes your network connections and detects internet availabilty on top. Those categories are reporter to Syncthing-Fork. So if Android considers hotspot as mobile data the app cannot do a better detection. Plus, there are hotspots with and without mobile data underlying. So getting the feature to be convenient in all common hotspot use cases would be as great as also impossible with the current API.

codethief commented 5 years ago

@Catfriend1 You mean, the reason Syncthing is not recognizing the hotspot is that Android doesn't report it as such because it's not connected to the internet?

Catfriend1 commented 5 years ago

@codethief yes, correct.

codethief commented 5 years ago

@Catfriend1 I have to thank you once again, the "force start" button has proven to be very useful – not just for when I connect to a wifi network that's not connected to the internet but also when there's no such network to begin with and I have to use my phone as a hotspot for my laptop. In this case, Syncthing doesn't fire up, either, but after manually starting it, my laptop and my phone synchronize beautifully.

Would there be a way for Syncthing to recognize when the phone's hotspot feature is enabled? I just read your earlier message again (regarding my hotspot at home):

I know why it's [not] recognizing the Hotspot. Android categorizes your network connections and detects internet availabilty on top. Those categories are reporter to Syncthing-Fork.

So, does that mean that Android can also report the category of "connections to networks that are not connected to the internet" to Syncthing? Wouldn't this solve all of the above problems or am I misunderstanding something?

Catfriend1 commented 5 years ago

Well, the report from Android of "no Internet connection" is the run condition "flight mode". We can't get more from Android :-/...

codethief commented 5 years ago

Oh :(

codethief commented 5 years ago

But maybe one could do a manual network scan every other minute or so to detect whether any IPs in the private IP address range are reachable?

Catfriend1 commented 5 years ago

I think that's the wrong way, background network queries/scans aren't allowed by Google policies as you would then have to use FCM which is impossible in the hotspot case... Sorry, but I can't imagine a possibility to do it "right" with given Android "best practices" atm. I also remember the times in the past doing ping scans with Tasker, since Android 6?.x it ceased working when display was off.