我正在尝试创建一个Tasker插件。
一切都很好,而且运行得很好。
我可以使用EditActivity和下面的代码配置要在我的应用程序中发送的字符串,如下所示:
resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE,PluginBundleManager.generateBundle(getApplicationContext(),message));
resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB,generateBlurb(getApplicationContext(), message));
setResult(RESULT_OK, resultIntent);例如,当我想要使用此代码来获取电池电量时,问题就来了,所以我添加了:
resultIntent.putExtra("net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS",com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB);但是应用程序不工作,我得到一个字符串%BATT作为结果,变量没有被替换……
因为我还没有找到任何例子,我很乐意得到一些帮助来使它工作。
发布于 2012-12-16 01:06:36
哦,愚蠢的我:
public static Bundle generateBundle(final Context context,final String message, boolean variable) {
final Bundle result = new Bundle();
result.putInt(BUNDLE_EXTRA_INT_VERSION_CODE,
Constants.getVersionCode(context));
result.putString(BUNDLE_EXTRA_STRING_MESSAGE, message);
result.putString("net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS",BUNDLE_EXTRA_STRING_MESSAGE);
return result;
}https://stackoverflow.com/questions/13894240
复制相似问题