0

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を取得しましたが、変数は置き換えられません...

例が見つからないので、それを機能させるための助けをいただければ幸いです。

4

1 に答える 1

2

痛い、愚かな私:

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;
}
于 2012-12-15T17:06:36.150 に答える