Listen for preset loaded events

Listen for preset loaded events#

Starting from v3.82 Kustom sends a broadcast when a preset finishes loading. This allows external apps like Tasker to react to preset changes.

Broadcast Action#

org.kustom.action.PRESET_LOADED

Extras#

ExtraTypeDescription
org.kustom.extra.SPACE_IDStringSpace URI (e.g. kspace://klwp/0, kspace://kwgt/123)
org.kustom.extra.PRESET_TITLEStringPreset title
org.kustom.extra.EXTERNALBooleanTrue if loaded via external request (Tasker, shortcut)

Tasker Example#

  1. Create a new Profile with Event > Intent Received
  2. Set Action to org.kustom.action.PRESET_LOADED
  3. In your Task, use %space_id, %preset_title, and %external variables

Android Code Example#

BroadcastReceiver receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String spaceId = intent.getStringExtra("org.kustom.extra.SPACE_ID");
        String title = intent.getStringExtra("org.kustom.extra.PRESET_TITLE");
        boolean external = intent.getBooleanExtra("org.kustom.extra.EXTERNAL", false);
    }
};

IntentFilter filter = new IntentFilter("org.kustom.action.PRESET_LOADED");
context.registerReceiver(receiver, filter);

Send variables to Kustom via Broadcast

Send variables to Kustom via Broadcast#

Kustom from version 2.09 allows third party apps to send variables via broadcasts. In order to send a broadcast to Kustom you will need this static entries defined in your code:

public static final String KUSTOM_ACTION = "org.kustom.action.SEND_VAR";  
public static final String KUSTOM_ACTION_EXT_NAME = "org.kustom.action.EXT_NAME";  
public static final String KUSTOM_ACTION_VAR_NAME = "org.kustom.action.VAR_NAME";  
public static final String KUSTOM_ACTION_VAR_VALUE = "org.kustom.action.VAR_VALUE";  
public static final String KUSTOM_ACTION_VAR_NAME_ARRAY = "org.kustom.action.VAR_NAME_ARRAY";  
public static final String KUSTOM_ACTION_VAR_VALUE_ARRAY = "org.kustom.action.VAR_VALUE_ARRAY";

Then you will need to send a broadcast always providing an “EXT_NAME” and then providing either a single name/value pair or an array of them. So, for example, if we have an application called “foo” that wants to send “myvar” with value “myvalue” you will do something like this:




Privacy Policy