Criteria

Launcher can match certain values against regular expressions to customize intents and groups

Overview

Filtering of custom intents and definition of implied groups can be accomplished with and/or criteria and regular expressions (regex). A criterion checks the value stored in a replacement variable from the device, Launcher, the configuration file, or session object against a regex pattern to determine what device behavior or layout should apply in a specific scenario.

Technical Guide

Criteria Arrays

Field
Description

criteria_OR

array Filters for instances where at least one field matches its pattern.

criteria_AND

array Filters for instances where all fields must must match their respective patterns.

Criteria Object Parameters

Field
Description

field

string A replacement variable, written in the format "_${replacement variable}" (e.g. "_${device.MODEL}").

pattern

string The regular expression that is desired to match the field's content.

Examples

Criteria for Custom Intent Filtering

"intents": {
    "boot": [
        // Run a StageNow XML on boot for all device models starting with "TC":
        {
            "typeIntent": "p",
            "action": "XML",
            "data": "file/path/to/stageNowFile.xml",
            "criteria_OR": [
                {
                    "field": "_${device.MODEL}",
                    "pattern": "/^TC.*$/"
                }
            ],
            "criteria_AND": []
        }
    ],
    "cradle": [
        // Rotate the Launcher to landscape on cradle for device models starting with "ET" or "CC":
        {
            "action": "com.bluefletch.launcher.ACTION_ROTATE_LANDSCAPE",
            "typeIntent": "p",
            "criteria_OR": [
                {
                    "field": "_${device.MODEL}",
                    "pattern": "/^ET.*$/"
                },
                {
                    "field": "_${device.MODEL}",
                    "pattern": "/^CC.*$/"
                }
            ],
            "criteria_AND": []
        },
        // Mute audio on cradle if device is logged out (no user ID) and is at site 1001:
        {
            "action": "MUTE_AUDIO",
            "typeIntent": "p",
            "criteria_AND": [
                {
                    "field": "_${session.userId}",
                    "pattern": "^_$"
                },
                {
                    "field": "_${config.ex.siteId}",
                    "pattern": "1001"
                }
            ],
            "criteria_OR": []            
        }
    ]                 
}

Criteria for Implied Groups

Last updated