I'm trying to send and receive intents to Macrodroid as part of a bigger app I'm developing.
I just need to send simple text back and forth.
I've read the intent examples for DS and have scraped the entire net for further help without success.
I've got a macro setup within MD to receive an intent sent from another macro in broadcast mode, so I've proved it's ready and waiting, but I'm not sure how to trigger it from a DS intent.
The intent action in the MD macro is just single word 'test' rather than a java package object, but the receive intent macro works just fine if it's action is set the same 'test'.
The text is sent as an extra with name "Colour" and text data as "Blue"
I wan tto duplicate the intent in DS to trigger the same macro.
My current code isn't much different from the DS example :-
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" )
//Create a button 1/3 of screen width and 1/10 screen height.
btn = app.CreateButton( "Send Intent", 0.3, 0.1 )
btn.SetOnTouch( btnTxt_OnTouch )
lay.AddChild( btn )
//Add layout to app.
app.AddLayout( lay )
}
//Send text to Macrodroid.
function btnTxt_OnTouch()
{
var textData = "Blue";
var packageName = "com.arlosoft.macrodroid"; // Macrodroid package
var className = null;
var action = "test";
var category = null;
var uri = null;
var type = null;
var extras = [
{name:"Colour", type:"string", value:textData},
];
extras = JSON.stringify( extras )
app.SendIntent(packageName, className, action, category, uri, type, extras)
}
Can anyone spot where I'm going wrong???
Thank you for any help