Category filter

How to deploy custom intents on Android devices?

What is Intent on Android?

Navigating through Android often involves shifting between applications as part of a single task. For instance, when scanning a QR code with a camera app, the system may automatically launch a web browser to open the encoded URL. This transition between applications is managed by passing an Intent to the system.

Intents are a fundamental part of how Android apps communicate and interact with each other. They serve as structured messages that instruct the system or an app on the necessary action to take. This could include opening a new screen (called an activity), starting a background task (called a service), or sending notifications to other apps or system components (via broadcast receivers).

Hexnode’s Deploy Intent: What is its primary use?

With Hexnode’s Deploy Intent action, IT administrators can remotely send custom intents to managed Android devices. By sending these custom intents, administrators can initiate targeted actions on devices, either implicitly or explicitly, depending on the use case.

How to deploy custom Intents from Hexnode?

Let’s walk through deploying custom intents on Android devices using Hexnode UEM.

Note:


The application targeted by the custom intent must be installed on the device for the intent to function.

To deploy custom intents on Android,

  1. Login to the Hexnode UEM console.
  2. Navigate to Manage > Devices.
  3. Select the Android device to which you want to deploy the custom intent.
  4. On the Device Details page, click Actions > Deployments > Deploy Intent.

    You can configure the following options:

    • Intent type: Choose between implicit and explicit, depending on how you want the system to handle the action.
      • Implicit: This intent type targets any app component that can handle the requested action, without specifying a particular app. It defines an action and provides data, which the system uses to find the most suitable app to perform the task. However, if multiple applications are capable of handling the request, the user will be given a choice to select their preferred one.

        For instance, if the intent is to open a web link, the system searches for compatible web browsers that can handle the request. If multiple browsers are available on the device, such as Google Chrome or Mozilla Firefox, the user will be prompted to select one, unless the default intent handler is already set on the device.

        Deploy Android custom intents using implicit intent type

      • Explicit: This intent type targets a specific app component within an application by providing the component’s class name. The class name acts as a unique identifier, allowing the system to target and open the exact component that should handle the requested action. This ensures that the desired part of the app is opened directly, without depending on the user’s choice or system defaults. The application to be used can be selected by clicking on the Select App option.

        For instance, if the intent is to open a web link, and you specifically choose a target app, like Mozilla Firefox, the link will be opened directly in that browser.

        Deploy Android custom intents using explicit intent type

    • Select application component: Choose an application component based on the operation you want to perform. The available options include,
      • Activity: Launches a user interface within an installed app, allowing the user to interact with the app’s screen or features. For example, opening a browser window or showing a map.
      • Service (for Explicit type): Starts a background operation within the app that runs without user interaction. This is used for tasks like downloading files, playing music, or syncing data.
      • Broadcast: Sends a system-wide or app-wide message to notify other components about events. Broadcast receivers listen for these messages and respond accordingly, such as handling network connectivity changes.
    • Action: Enter the action string that specifies the operation or task the intent should perform. For example, to display data to the user, such as viewing a web page, you can use the action string android.intent.action.VIEW. This is a required field.
    • Class (for Explicit type): Type the name of the class within the application that the intent targets. For instance, com.example.app.TargetActivity specifies the exact class (an Activity) within the app that the intent will open. This is a required field.
    • Data URI: Enter the Data URI string to specify the data associated with the intent for the receiving component. For example, to open a webpage, use a URL like https://www.hexnode.com/.
    • Data type: Specify the general format or category of the data associated with the intent. For instance, you can use text/plain for plain text and image/jpeg for JPEG images.
    • Category: Enter the category string to provide additional information about the component that should handle the intent. For example, the CATEGORY_LAUNCHER category indicates that the intent should be placed in the device’s app launcher.
    • Configure extras: Enter the key-value pairs that carry additional data with an intent. They allow one component to send information to another. For instance, you can include a string extra with the key “username” to pass a username to another activity.
  5. Click Execute to perform the action. If Explicit is selected as the intent type, first click Select App to choose the application that will handle the action, then click Execute.
  6. Note:


    The application selected to handle the action in Explicit intent type must contain the required application component. Otherwise, the intent may not function as expected.

What happens at the device end?

When an implicit intent is selected with the action VIEW, the specified webpage https://www.hexnode.com/ opens on the device using the default web browser, since no specific app is explicitly mentioned.

Frequently Asked Questions (FAQs)

  1. Can custom intent be deployed on applications that are not installed on the device?

    No, it is not possible to deploy Android custom intent on applications that aren’t installed on the device. For the intent to function properly, the target app must be present.

  2. Will deploying custom intent work if multiple apps can handle the same action?

    When deploying a custom intent implicitly, the user may be prompted to choose an app if multiple apps can handle the action, and no default intent handler has been set on the device. To ensure the intent works smoothly without user interaction, use an explicit intent to directly target a specific app when you deploy Android custom intent.

  3. Why might an action appear as failed in Action History during the deployment of Android custom intents?

    Possible reasons include,

    • Using an outdated version of the Hexnode UEM app.
    • Specifying an incorrect intent.
    • Targeting an app that is not installed on the device.
Remote Actions