syncthing / syncthing-android

Wrapper of syncthing for Android.
https://syncthing.net/
Mozilla Public License 2.0
3.52k stars 396 forks source link

[Enhancement] Android shortcuts and Locale plug-in interface support #91

Closed imraro closed 8 years ago

imraro commented 10 years ago

It might be very useful with various automation apps.

Nutomic commented 10 years ago

This is for Tasker and similar apps?

I don't use anything like that, so no idea what is needed.

Specific requests (or merge requests by those who need it) would be nice.

imraro commented 10 years ago

For example: I need to start scanning only when my phone connected to my home WiFi. I create profile "Start Syncthing at Home" with condition: "When connected to Home Wifi" and ation "Run shortcut (or Locale plug-in) Start Syncthing scanning"

Nutomic commented 10 years ago

This specific functionality is already implemented in the 0.5.0 beta.

imraro commented 10 years ago

I know. I'm testing it now ) It was a very simple example of automation, and even within this sample Syncthing can not determine when I want start syncing only when at home and not when I'm at work. Automation app solves this problems. Second example: I want to start syncing by schedule. Implementation of all these features in the app is a waste of your coding skills, I think. But with shortcuts (preferred because it is android standard) or Locale plug-in all things becomes easier )

Nutomic commented 10 years ago

Okay, would would be the exact APIs needed for these?

Does it work with intents or something like that?

imraro commented 10 years ago

http://codinggeekorg.wordpress.com/2011/01/02/android-how-to-add-home-screen-shortcuts-to-your-app/ , for example

imraro commented 10 years ago

For Locale plug-in: http://www.twofortyfouram.com/developer https://github.com/twofortyfouram/android-plugin-api-for-locale

Nutomic commented 10 years ago

I'm kind of hesitant to add specific support for a proprietary app.

But if anyone wants to implement this, ideally with support for an open source app, that would be great :)

imraro commented 10 years ago

1) Support for android shortcuts (not Locale plug-ins) is not support for a proprietary app. 2) http://forum.xda-developers.com/android/apps-games/app-sfen-profile-management-app-alpha-t2824497 ( https://github.com/lordgreg/Sfen )

Nutomic commented 10 years ago

Basically what I'm saying is, I don't have the time/interest to implement this myself, but if anyone wants to do it, just go ahead ;)

Btw Sfen looks interesting.

hadogenes commented 10 years ago

In tasker you can use REST api x-api-key you'll get from web GUI -> settings -> API Key Url: localhost:8080 http://habitrpg.wikia.com/wiki/User_blog:LadyAlys/Android's_Tasker_app_and_HabitRPG's_API

Here you have API https://discourse.syncthing.net/t/the-rest-interface/85

peter-sc commented 10 years ago

Please post your progress with Locale/Tasker then :-)

On 23.9.14 15:22, Jacek Szafarkiewicz wrote:

In tasker you can use REST api x-api-key you'll get from web GUI -> settings -> API Key http://habitrpg.wikia.com/wiki/User_blog:LadyAlys/Android's_Tasker_app_and_HabitRPG's_API http://habitrpg.wikia.com/wiki/User_blog:LadyAlys/Android%27s_Tasker_app_and_HabitRPG%27s_API

Here you have API https://discourse.syncthing.net/t/the-rest-interface/85

— Reply to this email directly or view it on GitHub https://github.com/Nutomic/syncthing-android/issues/91#issuecomment-56518170.

hadogenes commented 10 years ago

This works for Tasker I have this:

Syncthing REST
    A1: Variable Set [ Name:%url To:http://localhost:8080/rest/%par1?%par2 Do Maths:Off Append:Off ] 
    A2: Variable Set [ Name:%api_key To:XXXXXXXXXXX Do Maths:Off Append:Off ] 
    A3: JavaScriptlet [ Code:try {
    var http = new XMLHttpRequest(); 
    http.open("POST", global("url"),false);
    http.setRequestHeader("x-api-key", global("api_key"));
    http.send(http_post_data);
    var result = http.responseText;
}
catch(e) {
    var error = e.message;
} Libraries: Auto Exit:On Timeout (Seconds):30 ]

And I run this with e.g. Run Task with params: par1: scan par2: repo=sync

Nutomic commented 10 years ago

I think you should post this to discourse, it's easier to find and discuss there. And I'll close this issue, because it won't need any changes in the app then.

I also added code tags to your post ;)

imraro commented 10 years ago

It's not a complete solution. It's only workaround for one app (Tasker).

Nutomic commented 10 years ago

OK then I'll leave it open^^

Nutomic commented 8 years ago

Fixed by b9919adccd8dd1cddec48f7d514072810c765483.

sqrt-1764 commented 8 years ago

I just checked on my Nexus 5x (running Android N Preview) that there no activity handles "com.android.launcher.action.INSTALL_SHORTCUT". As indicated by some notes on StackOverflow this is no standard Android functionality. So I don't think it is worth the effort to implement.

But with #599 the functionality should be there to remotely start and stop syncthing by external applications now.

So maybe this issue can be closed now?

Nutomic commented 8 years ago

I'm not sure what you mean with INSTALL_SHORTCUT, that's not even mentioned in this issue?

And I already closed it ;)

sqrt-1764 commented 8 years ago

It's the intent-action used to install shortcuts to the home-screen as mentioned in the linked articles.

Nutomic commented 8 years ago

Ah I missed that. I think something like that should by handled by an external app.