Database trigger and actions

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Database trigger and actions

Post by Bluscre » 08 Sep 2017 20:48

Sorry for the short post but i think the content is very obvious ^~^

5o anyone else who's searching while it's still being implemented: https://play.google.com/store/apps/deta ... ugin&hl=en
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Database trigger and actions

Post by bogdyro » 09 Sep 2017 08:55

Well,the plugin is compatible with automagic also. Also it may not know it :)
However you can implement the same functionality by using execute root command SQLite.
I'm preparing the query strings in a script action and sending the commands after.
example:
path=/data/data/some_app/data.db
query="UPDATE alarm_instances SET vibrate ='0'; UPDATE alarm_templates SET vibrate='0'";
and then run root commamd
sqlite3 {path} "{query_
}"
Been using it to get a random song every time an alarm goes off.
By the way,can I ask what is your usage scenario?

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: Database trigger and actions

Post by Bluscre » 09 Sep 2017 13:14

Thats a sloppy workaround xD But what about triggers?

"When cell1row3 value in table USERS in database bla.sqlite changes"
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

ewill
Posts: 67
Joined: 20 Jul 2015 16:42

Re: Database trigger and actions

Post by ewill » 10 Sep 2017 20:56

I tried the plugin and I get a FC whenever I try to run it - even with a simple select statement.

Also, I the triggers don't appear for me when I use the plugin trigger.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Database trigger and actions

Post by bogdyro » 11 Sep 2017 05:51

Tested the plugin myself. It indeed FC whenever I run the action. Maybe it's an incopatibility with AM.
And the trigger is just a feature request, doesn't exist for now.
We're waiting Martin's input on this :)

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Database trigger and actions

Post by Martin » 11 Sep 2017 18:36

What are the steps required to reproduce the crash?
I'll take a look when time permits.

ewill
Posts: 67
Joined: 20 Jul 2015 16:42

Re: Database trigger and actions

Post by ewill » 11 Sep 2017 19:40

Here is what I tried.

Database path = /data/data/com.whatsapp/databases/msgstore.db

SQL statement = SELECT * FROM 'chat_list'

I know that the database path is correct.

I tried with and without the quote (that was a suggestion I found online).

I also tried
SELECT COUNT(*) FROM 'chat_list'

I tried some other more complex queries as well, but want to start simple.

Thanks for your interest.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Database trigger and actions

Post by bogdyro » 12 Sep 2017 05:05

@Martin
simple to reproduce, any run of the plugin causes it to crash. Tried with a path that requires root and another that doesn't. Query was simple like select * from table
@ewill
I assume that the phone is rooted,otherwise you don't have access to /data folder.
After the execute root command action, connect it to a debug dialog and run the flow. You should get either the output(stdout) or an error (stderror). What's the error message you're getting ?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Database trigger and actions

Post by Martin » 12 Sep 2017 08:31

Hi,

I made a quick tests and it seems that the plugin dies with a NullPointerException which means that some input might be missing or that the plugin can not read some input.
It might be caused by the plugin reading the input (file path) from the wrong field (from the wrong extras of the intent sent to the plugin) which is something another plugin also implemented in a wrong way in the past. The plugin needs to ensure that it properly follows the plugin specification. According to the ratings in Google Play the plugin seems to also fail in another automation app.

I'll try to contact the developer of the plugin to see if it can be fixed.

Regards,
Martin

ewill
Posts: 67
Joined: 20 Jul 2015 16:42

Re: Database trigger and actions

Post by ewill » 12 Sep 2017 11:12

Thank you Martin!

Locked