Example usage for android.telephony ServiceState newFromBundle

List of usage examples for android.telephony ServiceState newFromBundle

Introduction

In this page you can find the example usage for android.telephony ServiceState newFromBundle.

Prototype

@UnsupportedAppUsage
public static ServiceState newFromBundle(Bundle m) 

Source Link

Document

Create a new ServiceState from a intent notifier Bundle This method is used by PhoneStateIntentReceiver and maybe by external applications.

Usage

From source file:com.android.mms.ui.MessageUtils.java

public static int getCellularState(int selectedSubId, Context context) {
    MmsLog.d(TAG, "getCellularState() subid: " + selectedSubId);
    ITelephonyEx telephonyEx = ITelephonyEx.Stub
            .asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE_EX));
    Bundle bundle = null;/* w ww. ja  va  2 s .  c  om*/
    try {
        bundle = telephonyEx.getServiceState(selectedSubId);
    } catch (RemoteException e) {
        e.printStackTrace();
        return ServiceState.STATE_OUT_OF_SERVICE;
    }
    if (bundle != null) {
        return ServiceState.newFromBundle(bundle).getState();
    } else {
        return ServiceState.STATE_OUT_OF_SERVICE;
    }
}