FileDocCategorySizeDatePackage
CarrierMessagingServiceManager.javaAPI DocAndroid 5.1 API3852Thu Mar 12 22:22:54 GMT 2015android.telephony

CarrierMessagingServiceManager

public abstract class CarrierMessagingServiceManager extends Object
Provides basic structure for platform to connect to the carrier messaging service.

CarrierMessagingServiceManager carrierMessagingServiceManager = new CarrierMessagingServiceManagerImpl(); if (carrierMessagingServiceManager.bindToCarrierMessagingService(context, carrierPackageName)) { // wait for onServiceReady callback } else { // Unable to bind: handle error. }

Upon completion {@link #disposeConnection} should be called to unbind the CarrierMessagingService.

hide

Fields Summary
private volatile CarrierMessagingServiceConnection
mCarrierMessagingServiceConnection
Constructors Summary
Methods Summary
public booleanbindToCarrierMessagingService(android.content.Context context, java.lang.String carrierPackageName)
Binds to the carrier messaging service under package {@code carrierPackageName}. This method should be called exactly once.

param
context the context
param
carrierPackageName the carrier package name
return
true upon successfully binding to a carrier messaging service, false otherwise

        Preconditions.checkState(mCarrierMessagingServiceConnection == null);

        Intent intent = new Intent(CarrierMessagingService.SERVICE_INTERFACE);
        intent.setPackage(carrierPackageName);
        mCarrierMessagingServiceConnection = new CarrierMessagingServiceConnection();
        return context.bindService(intent, mCarrierMessagingServiceConnection,
                Context.BIND_AUTO_CREATE);
    
public voiddisposeConnection(android.content.Context context)
Unbinds the carrier messaging service. This method should be called exactly once.

param
context the context

        Preconditions.checkNotNull(mCarrierMessagingServiceConnection);
        context.unbindService(mCarrierMessagingServiceConnection);
        mCarrierMessagingServiceConnection = null;
    
protected abstract voidonServiceReady(android.service.carrier.ICarrierMessagingService carrierMessagingService)
Implemented by subclasses to use the carrier messaging service once it is ready.

param
carrierMessagingService the carrier messaing service interface