Trigger for SMBSync2 task

Post your questions and help other users.

Moderator: Martin

Post Reply
vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Trigger for SMBSync2 task

Post by vertigo » 26 Dec 2018 18:30

I'm trying to figure out how to run a scheduled task in SMBSync2 via Automagic but need some help. The developer of that app told me to refer to #5 (Starting from other applications) here, but I still couldn't get it working. I disabled auto sync in the task, since it looks like the instructions are saying to do so (though I tried with it enabled as well), and set up an Automagic action as follows:

Action Type: Send Broadcast (I'm on Android 8, so according to the instructions I should actually be using Send Activity, but there is no such action in Automagic)
Action: com.sentaroh.android.SMBSync2.ACTION_START_SYNC (I also tried ACTION_SYNC since when I open the "select action" dialog there's "android.intent.action.SYNC" but no START_SYNC)
Extras: putString("SyncProfile", "Pictures Sync"); (I wasn't sure at first what to put here, as the instructions you linked weren't clear and just said "test, test" and "prof1, prof2" for the second part, but figured it out looking in Automagic help)

Any help appreciated, really want to get this working.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Trigger for SMBSync2 task

Post by Desmanto » 27 Dec 2018 06:32

There is "Start Activity". The intent filter must be exactly the same as the dev stated, or it won't work. The extra should be correct already, using putString(). It seems the dev parse this string for comma delimited, and sync all those profiles stated (prof1 dan prof2).

Maybe you can try to tick the explicit component and choose the packagename com.sentaroh.android.SMBSync2, so the broadcast is specificly sent to the app. Leave the class name blank, or try to select the appropriate broadcast receiver. Try both Start Activity and Send broadcast.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Trigger for SMBSync2 task

Post by vertigo » 27 Dec 2018 21:52

Thanks! The action type needed to be "Start Activity" as suggested. Once I changed that it worked. The auto sync option for the task doesn't seem to matter, since it's working with that enabled. Also, it does have to be ACTION_START_SYNC, as it says in the instructions. I've run several tests and it seems to be working great. I've emailed the dev of SMBSync2 to let him know, so hopefully he'll update the instructions to make it more clear, but at least this is here now to help anyone else. Thanks again for the help!

Edit to add additional info:

It looks like the SMBSync2 dev updated the linked help file to clarify this, but how it shows how to launch multiple sync tasks is incorrect, showing a space after the comma separating them, when there can NOT be a space before OR after the comma. So in summary, here's what the Automagic action needs to look like:

Action Type: Start Activity
Action: com.sentaroh.android.SMBSync2.ACTION_START_SYNC
Extras: putString("SyncProfile", "Profile Name 1,Profile Name 2,Profile Name 3,etc");

Note there can be spaces in the profile names, just not between them, and that the entire string including all the names is wrapped in quotes. Double-check the spacing, because between habit and auto-correct, I keep finding myself entering them accidentally.

Post Reply