Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

RoleManagerCompat

class RoleManagerCompat
kotlin.Any
   ↳ androidx.core.role.RoleManagerCompat

This class contains the name and documentation for roles that might be available in the system.

The list of available roles might change with a system app update, so apps should not make assumption about the availability of roles. Instead, they should always check if the role is available using android.app.role.RoleManager#isRoleAvailable(String) before trying to do anything with it.

Summary

Constants

static String

The name of the assistant role.

static String

The name of the browser role.

static String

The name of the call redirection role.

static String

The name of the call screening and caller id role.

static String

The name of the dialer role.

static String

The name of the emergency role.

static String

The name of the home role.

static String

The name of the SMS role.

Constants

ROLE_ASSISTANT

static val ROLE_ASSISTANT: String

The name of the assistant role.

To qualify for this role, an application needs to either implement android.service.voice.VoiceInteractionService or handle android.content.Intent#ACTION_ASSIST. The application will be able to access call log and SMS for its functionality.

Value: "android.app.role.ASSISTANT"

ROLE_BROWSER

static val ROLE_BROWSER: String

The name of the browser role.

To qualify for this role, an application needs to handle the intent to browse the Internet:

<code>&lt;activity&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.VIEW" /&gt;
              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;data android:scheme="http" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      </code>
The application will be able to handle that intent by default.
Value: "android.app.role.BROWSER"

ROLE_CALL_REDIRECTION

static val ROLE_CALL_REDIRECTION: String

The name of the call redirection role.

To qualify for this role, an application needs to implement android.telecom.CallRedirectionService. The application will be able to re-write the phone number for an outgoing call to place the call through a call redirection service.

Value: "android.app.role.CALL_REDIRECTION"

ROLE_CALL_SCREENING

static val ROLE_CALL_SCREENING: String

The name of the call screening and caller id role.

To qualify for this role, an application needs to implement android.telecom.CallScreeningService. The application will be able to screen calls and provide call identification.

Value: "android.app.role.CALL_SCREENING"

ROLE_DIALER

static val ROLE_DIALER: String

The name of the dialer role.

To qualify for this role, an application needs to handle the intent to dial:

<code>&lt;activity&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.DIAL" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT"/&gt;
          &lt;/intent-filter&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.DIAL" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;data android:scheme="tel" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      </code>
The application will be able to handle those intents by default, and gain access to phone, contacts, SMS, microphone and camera.
Value: "android.app.role.DIALER"

ROLE_EMERGENCY

static val ROLE_EMERGENCY: String

The name of the emergency role.

You may not be able to request for this role on most devices as it's hidden by default and only for system apps.

To qualify for this role, an application needs to handle the intent for emergency assitance:

<code>&lt;activity&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.telephony.action.EMERGENCY_ASSISTANCE" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      </code>
The application will be used for emergency assistance.
Value: "android.app.role.EMERGENCY"

ROLE_HOME

static val ROLE_HOME: String

The name of the home role.

To qualify for this role, an application needs to handle the intent for home:

<code>&lt;activity&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;category android:name="android.intent.category.HOME" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      </code>
The application will be able to handle that intent by default, and used as the default home app.
Value: "android.app.role.HOME"

ROLE_SMS

static val ROLE_SMS: String

The name of the SMS role.

To qualify for this role, an application needs to declare the following components:

<code>&lt;activity&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.SENDTO" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;data android:scheme="smsto" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;service android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;data android:scheme="smsto" /&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
      &lt;receiver android:permission="android.permission.BROADCAST_SMS"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.provider.Telephony.SMS_DELIVER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;receiver android:permission="android.permission.BROADCAST_WAP_PUSH"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /&gt;
              &lt;data android:mimeType="application/vnd.wap.mms-message" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      </code>
The application will be able to handle the intent to send SMS by default, and gain access to phone, contacts, SMS, storage, microphone and camera.
Value: "android.app.role.SMS"