Example usage for android.telephony TelephonyManager PHONE_TYPE_CDMA

List of usage examples for android.telephony TelephonyManager PHONE_TYPE_CDMA

Introduction

In this page you can find the example usage for android.telephony TelephonyManager PHONE_TYPE_CDMA.

Prototype

int PHONE_TYPE_CDMA

To view the source code for android.telephony TelephonyManager PHONE_TYPE_CDMA.

Click Source Link

Document

Phone radio is CDMA.

Usage

From source file:com.secupwn.aimsicd.service.CellTracker.java

/**
 * Start FemtoCell detection tracking (For CDMA Devices ONLY!)
 *///  www . j  a v  a 2s  .  com
public void startTrackingFemto() {

    /* Check if it is a CDMA phone */
    if (device.getPhoneId() != TelephonyManager.PHONE_TYPE_CDMA) {
        Helpers.msgShort(context, context.getString(R.string.femtocell_only_on_cdma_devices));
        return;
    }

    trackingFemtocell = true;
    mPhoneStateListener = new PhoneStateListener() {
        public void onServiceStateChanged(ServiceState s) {
            log.debug(context.getString(R.string.service_state_changed));
            getServiceStateInfo(s);
        }
    };
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
    setNotification();
}

From source file:com.SecUpwN.AIMSICD.service.AimsicdService.java

/**
 * Start FemtoCell detection tracking//from w  w  w  .  j av a2  s. c o  m
 * CDMA Devices ONLY
 */
public void startTrackingFemto() {

    /* Check if it is a CDMA phone */
    if (mDevice.getPhoneID() != TelephonyManager.PHONE_TYPE_CDMA) {
        Helpers.msgShort(this, "AIMSICD can only detect Femtocell connections on CDMA devices.");
        return;
    }

    mTrackingFemtocell = true;
    mPhoneStateListener = new PhoneStateListener() {
        public void onServiceStateChanged(ServiceState s) {
            Log.d(TAG, "Service State changed!");
            getServiceStateInfo(s);
        }
    };
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
    setNotification();
}

From source file:com.android.bluetooth.map.BluetoothMapContent.java

private boolean smsSelected(FilterInfo fi, BluetoothMapAppParams ap) {
    int msgType = ap.getFilterMessageType();
    int phoneType = fi.phoneType;

    if (msgType == -1)
        return true;
    if ((msgType & 0x03) == 0)
        return true;

    if (((msgType & 0x01) == 0) && (phoneType == TelephonyManager.PHONE_TYPE_GSM))
        return true;

    if (((msgType & 0x02) == 0) && (phoneType == TelephonyManager.PHONE_TYPE_CDMA))
        return true;

    return false;
}

From source file:com.android.bluetooth.map.BluetoothMapContent.java

public byte[] getSmsMessage(long id, int charset) throws UnsupportedEncodingException {
    int type, threadId;
    long time = -1;
    String msgBody;/*from  www .j a v a2 s .co  m*/
    BluetoothMapbMessageSms message = new BluetoothMapbMessageSms();
    TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);

    Cursor c = mResolver.query(Sms.CONTENT_URI, SMS_PROJECTION, "_ID = " + id, null, null);
    if (c == null || !c.moveToFirst()) {
        throw new IllegalArgumentException("SMS handle not found");
    }

    try {
        if (V)
            Log.v(TAG, "c.count: " + c.getCount());

        if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
            message.setType(TYPE.SMS_GSM);
        } else if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
            message.setType(TYPE.SMS_CDMA);
        } else {
            // set SMS_GSM by default
            message.setType(TYPE.SMS_GSM);
        }

        String read = c.getString(c.getColumnIndex(Sms.READ));
        if (read.equalsIgnoreCase("1"))
            message.setStatus(true);
        else
            message.setStatus(false);

        type = c.getInt(c.getColumnIndex(Sms.TYPE));
        threadId = c.getInt(c.getColumnIndex(Sms.THREAD_ID));
        message.setFolder(getFolderName(type, threadId));

        msgBody = c.getString(c.getColumnIndex(Sms.BODY));

        String phone = c.getString(c.getColumnIndex(Sms.ADDRESS));

        time = c.getLong(c.getColumnIndex(Sms.DATE));
        if (type == 1) // Inbox message needs to set the vCard as originator
            setVCardFromPhoneNumber(message, phone, true);
        else // Other messages sets the vCard as the recipient
            setVCardFromPhoneNumber(message, phone, false);

        if (charset == MAP_MESSAGE_CHARSET_NATIVE) {
            if (type == 1) //Inbox
                message.setSmsBodyPdus(BluetoothMapSmsPdu.getDeliverPdus(msgBody, phone, time));
            else
                message.setSmsBodyPdus(BluetoothMapSmsPdu.getSubmitPdus(msgBody, phone));
        } else /*if (charset == MAP_MESSAGE_CHARSET_UTF8)*/ {
            message.setSmsBody(msgBody);
        }
    } finally {
        close(c);
    }

    return message.encode();
}

From source file:com.guardtrax.ui.screens.HomeScreen.java

String getPhoneType() {
    TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

    int phoneType = telephonyManager.getPhoneType();
    switch (phoneType) {
    case TelephonyManager.PHONE_TYPE_NONE:
        return "NONE";

    case TelephonyManager.PHONE_TYPE_GSM:
        return "GSM";

    case TelephonyManager.PHONE_TYPE_CDMA:
        return "CDMA";

    /*/*from  ww  w  .  j  a  v  a  2s  . co m*/
     *  for API Level 11 or above
     *  case TelephonyManager.PHONE_TYPE_SIP:
     *   return "SIP";
     */

    default:
        return "UNKNOWN";
    }
}