0

So I have been sending variables from my python scripts to the minimalistictext widget for a while using the Local intent.

This is my code from a previous question:

import android

droid = android.Android()

activity = 'com.twofortyfouram.locale.intent.action.FIRE_SETTING'
extras = {}
extras['de.devmil.minimaltext.locale.extras.VAR_NAME'] = 'test'
extras['de.devmil.minimaltext.locale.extras.VAR_TEXT'] = 'Passed'

packagename =  'de.devmil.minimaltext'
classname = 'de.devmil.minimaltext.locale.LocaleFireReceiver'

intent = droid.makeIntent(activity, None, None, extras, None, packagename, classname).result

droid.sendBroadcastIntent(intent)

Now I am trying to do the same with the Zooper widget, after contacting the developer he told me this:

just send a Broadcast with "org.zooper.zw.action. TASKERVAR" action, add a Bundle to the intent as "org.zooper.zw.tasker.var.extra.BUNDLE" with "org.zooper.zw.tasker.var.extra.STRING_VAR" and "org.zooper.zw.tasker.var.extra.STRING_TEXT".

I unfortunately have only limited understanding on how the intent system works but I have tried several approaches that I thought might be it:

import android

droid = android.Android()

activity = 'org.zooper.zw.action.TASKERVAR'
extras = {}
extras['org.zooper.zw.tasker.var.extra.STRING_VAR'] = '#TTest#'
extras['org.zooper.zw.tasker.var.extra.STRING_TEXT'] = 'Passed'

packagename =  'org.zooper.zw'
classname = 'org.zooper.zw.tasker.var.extra.BUNDLE'

intent = droid.makeIntent(activity, None, None, extras, None, packagename, classname).result

droid.sendBroadcastIntent(intent)

and

import android

droid = android.Android()

activity = 'org.zooper.zw.action.TASKERVAR'
extras = {}
extras['org.zooper.zw.tasker.var.extra.BUNDLE'] = {'org.zooper.zw.tasker.var.extra.STRING_VAR':'#TTest#','org.zooper.zw.tasker.var.extra.STRING_TEXT':'Passed'}

intent = droid.makeIntent(activity, None, None, extras, None, None, None).result

droid.sendBroadcastIntent(intent)

Unfortunately non of this works.

Community
  • 1
  • 1
JimyKK
  • 48
  • 8

1 Answers1

3

I just tried making something similar in SDK and I found out that you should pass in the bundle an integer too, key is "org.zooper.zw.tasker.var.extra.INT_VERSION_CODE" with value "1".

Don't know how to do this in Python, but this is my snippet in Java (it works, I tested it)

public static final String INTENT_ACTION = "org.zooper.zw.action.TASKERVAR";
public static final String BUNDLE_STRING_NAME =  "org.zooper.zw.tasker.var.extra.STRING_VAR";
public static final String BUNDLE_STRING_VALUE = "org.zooper.zw.tasker.var.extra.STRING_TEXT";
public static final String BUNDLE_VERSION_CODE = "org.zooper.zw.tasker.var.extra.INT_VERSION_CODE";
public static final String BUNDLE_NAME = "org.zooper.zw.tasker.var.extra.BUNDLE";
public static final String VARIABLE_NAME = "test";

public void sendUpdate() {
   Intent in = new Intent(INTENT_ACTION);
   Bundle b = new Bundle();
   String value = "Final variable value";
   b.putInt(BUNDLE_VERSION_CODE, 1);
   b.putString(BUNDLE_STRING_NAME, VARIABLE_NAME);
   b.putString(BUNDLE_STRING_VALUE, value);
   in.putExtra(BUNDLE_NAME, b);
   sendBroadcast(in);
}

This works for me. Without the b.putInt(BUNDLE_VERSION_CODE, 1) it didn't work. I know it's a old question, but I hope to help.

c0m3tx
  • 98
  • 1
  • 7