giech/arduinotaskerbluetooth

passing text variable from tasker

Closed this issue · 3 comments

How to send the text variable from tasker via bluetooth ??

Hi, I modified the android app to do that (TaskerPlugin.Setting.setVariableReplaceKeys) :

    // Method that returns the bundle to be saved
    @Override
    public Bundle getResultBundle() {
        String mac = macText.getText().toString();
        String msg = ((EditText) findViewById(R.id.msg)).getText().toString();
        boolean crlf = ((CheckBox) findViewById(R.id.checkbox)).isChecked();

        Bundle bundle = new Bundle();
        bundle = BundleManager.generateBundle(mac, msg, crlf);;

        if (TaskerPlugin.Setting.hostSupportsOnFireVariableReplacement(this))
            TaskerPlugin.Setting.setVariableReplaceKeys(bundle, new String[]{"com.giechaskiel.ilias.bluetoothserialfromtasker.STRING_MSG"});

        //return BundleManager.generateBundle(mac, msg, crlf);
        return bundle;
    }

in the PluginActivity.java file.

You also have to add the TaskerPlugin. java file to the project.
It's my first test with java and android studio, so I hope there is no stupid mistake...

giech commented

Thank you both for this issue. I have updated the code to allow for variable use in both the Bluetooth MAC field and the message field (but not the CRLF boolean). Both the code and the APK have been updated to reflect this.

You're welcome.