Android custom intent

Use the Android custom intent capability to preconfigure settings and create custom workflows to open only specific parts of the Settings app on an Android device in kiosk mode.

Kiosk mode usage on Android devices is on the rise. These devices in kiosk mode are in a lockdown state where users don't have access to settings like Biometrics, Password, NFC, and so on which are required for day-to-day work. The Android custom intent capability provides flexibility to control the settings that are exposed to users. For example, opening the Biometric enrollment screen from the device without adding the Settings app to an allow list in the COSU Kiosk mode policy.

Configuring Android custom intent

  1. From the IBM® MaaS360® Portal Home page, click Security > Policies.
  2. Select an Android MDM Polciy policy.
  3. Go to Configure settings > Android Enterprise Settings > COSU (Kiosk mode) and then click Enable Kiosk Mode.
  4. Expand the Kiosk Device Settings section and configure the following:
    Policy setting Description Supported devices
    Add custom launch item

    If this setting is turned on, you can add custom launch using the Android custom intent capability. You can add settings or applications by using JSON code on an Android device in kiosk mode. For more information on JSON code format, see JSON code format.

    Important:
    • Enabling this setting might allow users to navigate to other relevant sections related to this setting on the device.
    • This feature is applicable for devices with Android app version 8.60 or later.

    You can add multiple custom launch items, each containing the following settings:

    • Item location on device: Based on item location you have selected, the custom launch item is shown under either the Device Settings or Other Shortcuts section in the menu list on the device.
    • Item name: You can add custom launch item name in multiple locales. The item name will be shown on the device with the relevant locale set for the Kiosk app.

      You can enter the key-value pair where key represents the locale for the item name display and value represents the item name.

    • Item description: You can add relevant description for a custom launch item in multiple locales.

      You can enter the key-value pair where key represents the locale for the item description display and value represents the item description.

    • Custom intent: To define an Android custom intent, you must provide JSON code that specifies the necessary policy values. For more information, see Examples for defining Android custom intent.
    Android 8.60+ DO

JSON code format

The following tables provide the sample JSON code format for the top level fields and extra fields:

Top level fields
Field name Type Examples Description

action

String

"action": "android.intent.action.VIEW"
"action": "android.intent.action.EDIT"

The general action to be performed. For example, ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, and so on.

data

String

"data": "https://www.company.com#data"

The data to operate on. For example, a person's record in the contacts database, expressed as a Uri.

packageName

String

"packageName": "com.mycompany.myapp"

Limit the action to only open a specific package.

categories

String

Array

"categories": [
    "android.intent.category.LAUNCHER",
    "android.intent.category.BROWSABLE"
]
Additional information about the action to execute. For example,
  • CATEGORY_LAUNCHER indicates an activity that must appear in the Kiosk Launcher app on the device as a top-level application.
  • CATEGORY_ALTERNATIVE indicates an activity that must be included in a list of alternative actions the user can perform on the data.

type

String

"type": "text/xml"

Specifies an explicit MIME type for the intent data. The type is inferred from the data itself. By setting this attribute, you disable that evaluation and enforce the use of an explicit type.

component

Object

"component": {
    "packageName": "com.mycompany.myapp",
    "className": "com.mycompany.myapp.ui.MyActivity"
}

Specifies an explicit name of a component class to use for the intent. The component is determined from the other information in the intent, such as the action, data or type, and categories, matching it with a suitable component. If this attribute is set, no evaluation is performed, and this specified component is used directly. By specifying this attribute, all other fields become optional.

  • packageName: Indicates the package name of the component. Type: String
  • className: Indicates the class name of the component. Type: String

flags

Integer Array

"flags": [2, 4, 8, 32]

Additional flags that might modify the behavior. For the list of flags, see https://developer.android.com/reference/android/content/Intent.

extras

Object Array

"extras": [
 {
   "type": "string",
   "name": "com.mycompany.myapp.SOME_STRING_EXTRA",
    "value": "Some Value Here"
 },
 {
   "type": "integerArray",
   "name": "com.mycompany.myapp.SOME_INT_ARRAY_EXTRA",
   "value": [2, 3, 4]
 },
 {
   "type": "bundle",
   "name": "com.mycompany.myapp.SOME_BUNDLE_EXTRA",
   "value": [
     {
        "type": "string", 
        "name": "SomeBundleString", 
        "value": "Some Value Here"
     },
     {
        "type": "byteArray", 
        "name": "SomeBundleByteArray", 
        "value": [5, 6, 7]
     }
   ]
 }
]

Adds additional information that can be passed in the intent. For more information on extra field, see Extra fields.

Extra fields
Field name Type Examples Description

type

String

"type": "string"
"type": "integerArray"
"type": "bundle"

The type of the extra information are:

  • Base types

    The following data types are supported:

    • boolean: The value of the extra information must be a string that is either true or false.
    • char: The value of the extra information must be a string with only one character.
    • string: The value of the extra information must be a string, and can be of any length.
    • byte: The value of the extra information must be an integer between -128 and 127.
    • integer: The value of the extra information must be an integer between -2147483648 and 2147483647.
    • short: The value of the extra information must be an integer between -32768 and 32767.
    • long: The value of the extra information must be an integer between -9223372036854775808 and 9223372036854775807.
    • float: The value of the extra information must be a decimal number.
    • double: The value of the extra information must be a decimal number. This type has higher precision than float.
  • Array types

    This type has the same definitions as the Base type, but are added with array syntax in square brackets. The types supported are:

    • booleanArray
    • stringArray
    • charArray
    • byteArray
    • integerArray
    • shortArray
    • longArray
    • floatArray
    • doubleArray
  • ArrayList types

    Some apps also support receiving data in ArrayList types. This type has the same definitions and syntax as the Array types. The following types are supported:

    • integerArrayList
    • stringArrayList
  • Bundle type

    To create nested extra information, use the bundle type. The value must be an array of extra information.

    For example:

    {
       "type": "bundle",
       "name": "com.mycompany.myapp.SOME_BUNDLE_EXTRA",
       "value": [
         {
            "type": "string", 
            "name": "SomeBundleString", 
            "value": "Some Value Here"
         },
         {
            "type": "byteArray", 
            "name": "SomeBundleByteArray", 
            "value": [5, 6, 7]
         }
       ]
     }

name

String

"name": "com.mycompany.myapp.SOME_STRING_EXTRA"
"name": "com.mycompany.myapp.SOME_INT_ARRAY_EXTRA"

The name of the extra information.

value

Depends on type

"value": "Some Value Here"
"value": [5, 6, 7]
"value": 3.534
"value": null

The value of the extra information. Values can be added based on the type.

Note: In all cases, the value can be specified as null. In this case, a null value is passed to the target application.
Example for defining JSON code
{
  "action": "android.intent.action.VIEW",
  "data": "https://www.company.com#data",
  "packageName": "com.mycompany.myapp",
  "categories": [
    "android.intent.category.LAUNCHER",
    "android.intent.category.BROWSABLE"
  ],
  "type": "text/xml",
  "component": {
    "packageName": "com.mycompany.myapp",
    "className": "com.mycompany.myapp.ui.MyActivity"
  },
  "flags": [2, 4, 8, 32],
  "extras": [
    {
      "type": "string",
      "name": "com.mycompany.myapp.SOME_STRING_EXTRA",
      "value": "Some Value Here"
    },
    {
      "type": "integerArray",
      "name": "com.mycompany.myapp.SOME_INT_ARRAY_EXTRA",
      "value": [2, 3, 4]
    },
    {
      "type": "bundle",
      "name": "com.mycompany.myapp.SOME_BUNDLE_EXTRA",
      "value": [
        {
           "type": "string", 
           "name": "SomeBundleString", 
           "value": "Some Value Here"
        },
        {
           "type": "byteArray", 
           "name": "SomeBundleByteArray", 
           "value": [5, 6, 7]
        }
      ]
    }
  ]
}

Examples for defining Android custom intent

The following table provides examples for policy values that can be configured to create Android custom intent for various common scenarios.

For more information on intent action settings provided by Google Android, see https://developer.android.com/reference/android/provider/Settings.

Common Scenario Item location on device Item name Item description Custom intent (JSON)

Open the Sound Settings screen on the device. For more information, see Common Scenario 1.

Settings

Sound Settings

Click here to view the Sound Settings of the device.

{
"action": "android.settings.SOUND_SETTINGS"
}

Open any settings screen on the device. For example, the Data Usage Settings screen.

Settings

Data Usage Settings

Click here to view the Data Usage Settings of the device.

{
"action": "android.settings.DATA_USAGE_SETTINGS"
}

Open an app on the device. For example, Google Chrome.

It opens the app specified in the package name, just like tapping the app's icon on the device's home screen.

Other Shortcuts

Open Google Chrome

Click here to open the Google Chrome app.

{
  "action": "android.intent.action.MAIN",
  "packageName": "com.android.chrome",
  "categories": [
     "android.intent.category.LAUNCHER"
   ]
}

View a website on the device screen. For example, Wikipedia.

It opens the web browser to the start the specified URL. The category is added to ensure that only web browsers are considered for opening.

Other Shortcuts

Open Wikipedia

Click here to open the Wikipedia website in the default browser.

{
  "action": "android.intent.action.VIEW",
  "data": "https://www.wikipedia.org",
  "categories": [
     "android.intent.category.BROWSABLE"
  ]
}

View a website on the device screen using a specific browser. For example, view Google on Mozilla Firefox.

Opens Firefox to view the specified URL.

Other Shortcuts

Open Website in Firefox

Click here to open the specified website in the Firefox browser.

{
  "action": "android.intent.action.VIEW",
  "data": "https://www.google.com",
  "packageName": "org.mozilla.firefox"
}

Dial a number on the device screen. For example, open the handset dialer on the device screen with the number 911 entered, and then the user presses the Dial button.

Other Shortcuts

Emergency Contact

Click here to call the Emergency number.

{
  "action": "android.intent.action.DIAL",
  "data": "tel:911"
}

Send an email using Secure Mail. For example, opens a Secure Mail composer with the subject and mail body already completed.

Other Shortcuts

Compose mail using MaaS360 Secure Mail

Click here to compose mail using MaaS360 Secure Mail.

{
  "action": "android.intent.action.SENDTO",
  "packageName": "com.fiberlink.maas360.android.pim",
  "data": "mailto:abc@company.com",
  "extras": [
     {
        "type": "string",
        "name": "android.intent.extra.SUBJECT",
        "value": "Email Subject Goes Here"
     },
     {
        "type": "string",
        "name": "android.intent.extra.TEXT",
        "value": "Email Body Goes Here"
     }
  ]
}

Send an email using Gmail. For example, opens a Gmail composer with the subject and mail body already completed.

Other Shortcuts

Compose mail using Gmail

Click here to compose mail on Gmail app.

{
  "action": "android.intent.action.SENDTO",
  "packageName": "com.google.android.gm",
  "data": "mailto:abc@company.com?subject=The%20subject%20of%20the%20mail&body=The%20body%20of%20the%20email"
}

Display contacts list on the device screen. For example, display the list of device contacts. Typically opens the device Contacts app.

Other Shortcuts

Open Contacts

Click here to open Contacts app.

{
  "action": "android.intent.action.VIEW",
  "data": "content://contacts/people/"
}
Common Scenario 1:

Creating Custom intent for Sound Settings in the MaaS360 Portal

On the Maas360 Portal, configure the following policy values to open the Sound Settings screen on the device screen.

Policy setting Value Description
Add custom launch item
  • Item location on device: Settings
  • Item name: Sound Settings
  • Item description: Click here to view Sound Settings of the device
  • Custom intent:
    {
    "action": "android.settings.SOUND_SETTINGS"
    }
Open the Sound Settings screen on the device.

Opening Sound Settings on the Android device in Kiosk mode

  1. Click Settings icon on the Android device.
  2. Click Device Settings on the Menu list.
    settings menu in android device in kiosk mode

    As per the configured custom intent, the Sound Settings custom launch item is shown under Device Settings section in the menu list.

    sound settings in android device in kiosk mode
  3. Click Sound Settings.

    You are navigated to the Sound Settings section of the Android device.