Skip to content

Most visited

Recently visited



public abstract class CarrierService
extends Service

   ↳ android.content.Context
     ↳ android.content.ContextWrapper
         ↳ android.service.carrier.CarrierService

A service that exposes carrier-specific functionality to the system.

To extend this class, you must declare the service in your manifest file to require the BIND_CARRIER_SERVICES permission and include an intent filter with the CARRIER_SERVICE_INTERFACE. If the service should have a long-lived binding, set android.service.carrier.LONG_LIVED_BINDING to true in the service's metadata. For example:

<service android:name=".MyCarrierService"
      <action android:name="android.service.carrier.CarrierService" />
  <meta-data android:name="android.service.carrier.LONG_LIVED_BINDING"
             android:value="true" />




Inherited constants

From class
From class android.content.Context
From interface android.content.ComponentCallbacks2

Public constructors


Public methods

final void notifyCarrierNetworkChange(boolean active)

Informs the system of an intentional upcoming carrier network change by a carrier app.

IBinder onBind(Intent intent)

If overriding this method, call through to the super method for any unknown actions.

abstract PersistableBundle onLoadConfig(CarrierIdentifier id)

Override this method to set carrier configuration.

Inherited methods

From class
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks



added in API level 23

Constant Value: "android.service.carrier.CarrierService"

Public constructors


added in API level 23
CarrierService ()

Public methods


added in API level 23
void notifyCarrierNetworkChange (boolean active)

Informs the system of an intentional upcoming carrier network change by a carrier app. This call is optional and is only used to allow the system to provide alternative UI while telephony is performing an action that may result in intentional, temporary network lack of connectivity.

Based on the active parameter passed in, this method will either show or hide the alternative UI. There is no timeout associated with showing this UX, so a carrier app must be sure to call with active set to false sometime after calling with it set to true.

Requires Permission: MODIFY_PHONE_STATE or the calling app has carrier privileges.

active boolean: Whether the carrier network change is or shortly will be active. Set this value to true to begin showing alternative UI and false to stop.


added in API level 23
IBinder onBind (Intent intent)

If overriding this method, call through to the super method for any unknown actions. Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

If you override this method you must call through to the superclass implementation.

intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.

IBinder Return an IBinder through which clients can call on to the service.


added in API level 23
PersistableBundle onLoadConfig (CarrierIdentifier id)

Override this method to set carrier configuration.

This method will be called by telephony services to get carrier-specific configuration values. The returned config will be saved by the system until,

  1. The carrier app package is updated, or
  2. The carrier app requests a reload with notifyConfigChangedForSubId.
This method can be called after a SIM card loads, which may be before or after boot.

This method should not block for a long time. If expensive operations (e.g. network access) are required, this method can schedule the work and return null. Then, use notifyConfigChangedForSubId to trigger a reload when the config is ready.

Implementations should use the keys defined in CarrierConfigManager. Any configuration values not set in the returned PersistableBundle may be overridden by the system's default configuration service.

id CarrierIdentifier: contains details about the current carrier that can be used do decide what configuration values to return.

PersistableBundle a PersistableBundle object containing the configuration or null if default values should be used.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)