Page 1 of 1

Trigger Plugin

Posted: 10 Jun 2014 17:48
by Bahevi
Hello!

I'm trying to create a Trigger Plugin, Automagic detects my app, but the trigger is not fired.
I checked Tasker and Locale Guides and if i understood them right, this is what i have to call:

Intent intent = new Intent();
intent.setAction("com.twofortyfouram.locale.intent.action.REQUEST_QUERY");
intent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_ACTIVITY,TriggerActivity.class.getName());
sendBroadcast(intent);

but the trigger isn't fired in the app...
Any idea what i'm doing wrong?

Greetings

Re: Trigger Plugin

Posted: 10 Jun 2014 18:02
by Martin
Hi,

Locale has an example of a condition plugin in their developer documentation:
http://www.twofortyfouram.com/developer

I recommend to use the Locale Display Condition available in the download section as a starting point and then modify this example to suit your needs.

Do you want to use your plugin purely in a trigger or also in a condition?

Regards,
Martin

Re: Trigger Plugin

Posted: 10 Jun 2014 18:20
by Bahevi
I want to use it purely as a trigger.
I used the Locale Display Condition and modified it as said in the Tasker plugin guide, but that didn't work.
Don't get me wrong, the app is detected, but the trigger doesn't fire...

Re: Trigger Plugin

Posted: 11 Jun 2014 15:45
by Martin
Do you receive the broadcast with action com.twofortyfouram.locale.intent.action.QUERY_CONDITION from Automagic after you have sent the REQUEST_QUERY intent? Is your broadcast receiver for the com.twofortyfouram.locale.intent.action.QUERY_CONDITION properly registered in the AndroidManifest.xml?

Is there anything in the log when you enable Debug log in the preferences of Automagic and make the plugin check its state?

If you like, you can send the plugin apk to info@automagic4android.com, so I can check what events Automagic receives and if there's anything missing in your plugins manifest.

Re: Trigger Plugin

Posted: 16 Jun 2014 09:41
by Bahevi
Debug log is enabled.

06-16 11:35:02.521: D/AM_ActionManagerService(3705): Received intent Intent { act=com.twofortyfouram.locale.intent.action.REQUEST_QUERY flg=0x10 (has extras) } extras: com.twofortyfouram.locale.intent.extra.ACTIVITY=com.triggertest.shaketrigger.ui.TriggerActivity
06-16 11:35:02.541: D/AM_ActionManagerService(3705): Received intent finished

I know a shake-trigger already exists, just wrote my own for testing the plugin feature.
In my project there is a Service listening to sensors and then sending the intent and the Activity for the UI.

Re: Trigger Plugin

Posted: 16 Jun 2014 15:32
by Martin
I don't see anything in the log that indicates that Automagic checked the condition using com.twofortyfouram.locale.intent.action.QUERY_CONDITION, so the broadcast receiver might not declared in the manifest of your plugin.
Could you please send the APK to info@automagic4android.com, so I can check what's missing.