Example usage for android.telephony TelephonyManager PHONE_TYPE_NONE

List of usage examples for android.telephony TelephonyManager PHONE_TYPE_NONE

Introduction

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

Prototype

int PHONE_TYPE_NONE

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

Click Source Link

Document

No phone radio.

Usage

From source file:Main.java

/**
 * //from   ww  w  . j a va2 s. c om
 * @param type
 * @return
 */
public static String getTelephonyPhoneType(int type) {
    switch (type) {
    case TelephonyManager.PHONE_TYPE_CDMA:
        return "CDMA";
    case TelephonyManager.PHONE_TYPE_GSM:
        return "GSM";
    case TelephonyManager.PHONE_TYPE_NONE:
        return "None";
    default:
        return "Unknown[" + type + "]";
    }
}

From source file:fr.inria.ucn.listeners.MyPhoneStateListener.java

/**
 * //from ww  w.java 2s . c o m
 * @param c
 */
public void enable(Context c) {
    TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE) {
        tm.listen(this,
                PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
        this.c = c;
    } // else no telephony
}

From source file:local.plugin.phonecheck.PhoneCheck.java

private String check() {
    String response;//from  www  . j  av a  2 s  .co m
    try {
        if (((TelephonyManager) this.cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE))
                .getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
            response = "IMPOSSIBLE";
        } else {
            response = "CANCALL";
        }
    } catch (Exception e) {
        response = "UNKNOWN";
    }

    return response;
}

From source file:fr.inria.ucn.listeners.MyPhoneStateListener.java

/**
 * /* ww w . ja  va  2 s.c  o  m*/
 * @param c
 */
public void disable(Context c) {
    TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE) {
        tm.listen(this, PhoneStateListener.LISTEN_NONE);
        this.c = null;
    } // else no telephony
}

From source file:com.oliversride.wordryo.Utils.java

public static boolean deviceSupportsSMS(Context context) {
    if (null == s_deviceSupportSMS) {
        boolean doesSMS = false;
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        if (null != tm) {
            int type = tm.getPhoneType();
            doesSMS = TelephonyManager.PHONE_TYPE_NONE != type;
        }/*from  w w  w  .j a  v  a2 s.  c  o  m*/
        s_deviceSupportSMS = new Boolean(doesSMS);
    }
    return s_deviceSupportSMS;
}

From source file:com.secupwn.aimsicd.ui.fragments.DeviceFragment.java

private void updateUI() {
    HighlightTextView content;/*from w  ww .  j  av a 2 s . com*/
    TableRow tr;
    if (mBound) {
        final AnimationManager ani = new AnimationManager();

        mAimsicdService.getCellTracker().refreshDevice();
        Device mDevice = mAimsicdService.getCellTracker().getDevice();
        switch (mDevice.getPhoneId()) {

        case TelephonyManager.PHONE_TYPE_NONE: // Maybe bad!
        case TelephonyManager.PHONE_TYPE_SIP: // Maybe bad!
        case TelephonyManager.PHONE_TYPE_GSM: {
            content = (HighlightTextView) getView().findViewById(R.id.network_lac);
            content.updateText(String.valueOf(mAimsicdService.getCell().getLocationAreaCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.gsm_cellid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_cellid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getCellId()), ani);
            break;
        }

        case TelephonyManager.PHONE_TYPE_CDMA: {
            tr = (TableRow) getView().findViewById(R.id.cdma_netid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_netid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getLocationAreaCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.cdma_sysid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_sysid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getSid()), ani);
            tr = (TableRow) getView().findViewById(R.id.cdma_baseid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_baseid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getCellId()), ani);
            break;
        }
        }

        if (mAimsicdService.getCell().getTimingAdvance() != Integer.MAX_VALUE) {
            tr = (TableRow) getView().findViewById(R.id.lte_timing_advance);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_lte_timing_advance);
            content.updateText(String.valueOf(mAimsicdService.getCell().getTimingAdvance()), ani);
        } else {
            tr = (TableRow) getView().findViewById(R.id.lte_timing_advance);
            tr.setVisibility(View.GONE);
        }

        if (mAimsicdService.getCell().getPrimaryScramblingCode() != Integer.MAX_VALUE) {
            content = (HighlightTextView) getView().findViewById(R.id.network_psc);
            content.updateText(String.valueOf(mAimsicdService.getCell().getPrimaryScramblingCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.primary_scrambling_code);
            tr.setVisibility(View.VISIBLE);
        }

        String notAvailable = getString(R.string.n_a);

        content = (HighlightTextView) getView().findViewById(R.id.sim_country);
        content.updateText(mDevice.getSimCountry().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_operator_id);
        content.updateText(mDevice.getSimOperator().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_operator_name);
        content.updateText(mDevice.getSimOperatorName().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_imsi);
        content.updateText(mDevice.getSimSubs().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_serial);
        content.updateText(mDevice.getSimSerial().orElse(notAvailable), ani);

        content = (HighlightTextView) getView().findViewById(R.id.device_type);
        content.updateText(mDevice.getPhoneType(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.device_imei);
        content.updateText(mDevice.getIMEI(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.device_version);
        content.updateText(mDevice.getIMEIv(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_name);
        content.updateText(mDevice.getNetworkName(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_code);
        content.updateText(mDevice.getMncMcc(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_type);
        content.updateText(mDevice.getNetworkTypeName(), ani);

        content = (HighlightTextView) getView().findViewById(R.id.data_activity);
        content.updateText(mDevice.getDataActivityType(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.data_status);
        content.updateText(mDevice.getDataState(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_roaming);
        content.updateText(String.valueOf(mDevice.isRoaming()), ani);

        ani.startAnimation(5000);
    }
}

From source file:org.pixmob.droidlink.ui.EventDetailsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    // Include actions for calling and writing SMS only for phones.
    final TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    final boolean deviceIsPhone = tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
    if (deviceIsPhone) {
        menu.add(NONE, R.string.call, NONE, R.string.call).setIcon(R.drawable.ic_menu_call)
                .setShowAsAction(SHOW_AS_ACTION_ALWAYS);
        menu.add(NONE, R.string.compose_sms, NONE, R.string.compose_sms).setIcon(R.drawable.ic_menu_compose)
                .setShowAsAction(SHOW_AS_ACTION_ALWAYS);
    }/*from w  ww  .ja v a  2 s .  c  o  m*/

    menu.add(NONE, R.string.delete_event, NONE, R.string.delete_event).setIcon(R.drawable.ic_menu_delete)
            .setShowAsAction(SHOW_AS_ACTION_IF_ROOM);
}

From source file:org.most.input.CellInput.java

@Override
public void workToDo() {
    CellLocation cellLocation = _telephonyManager.getCellLocation();
    _telephonyManager.listen(_phoneStateListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
    nciList = _telephonyManager.getNeighboringCellInfo();
    DataBundle b = _bundlePool.borrowBundle();
    if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmLocation = (GsmCellLocation) cellLocation;
        b.putInt(KEY_GSM_CELL_ID, gsmLocation.getCid());
        b.putInt(KEY_GSM_LAC, gsmLocation.getLac());
        b.putInt(KEY_RSSI, _phoneStateListener.signalStrengthValue);
        // gsmLocation.getPsc() require api 9
        // b.putInt(KEY_GSM_PSC, gsmLocation.getPsc());
        b.putInt(KEY_PHONE_TYPE, TelephonyManager.PHONE_TYPE_GSM);
    } else if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation;
        b.putInt(KEY_BASE_STATION_ID, cdmaLocation.getBaseStationId());
        b.putInt(KEY_BASE_STATION_LATITUDE, cdmaLocation.getBaseStationLatitude());
        b.putInt(KEY_BASE_STATION_LONGITUDE, cdmaLocation.getBaseStationLongitude());
        b.putInt(KEY_BASE_NETWORK_ID, cdmaLocation.getNetworkId());
        b.putInt(KEY_BASE_SYSTEM_ID, cdmaLocation.getSystemId());
        b.putInt(KEY_PHONE_TYPE, TelephonyManager.PHONE_TYPE_CDMA);
    } else {// ww  w  .j  a va 2 s. c om
        b.putInt(KEY_PHONE_TYPE, TelephonyManager.PHONE_TYPE_NONE);
    }
    b.putLong(Input.KEY_TIMESTAMP, System.currentTimeMillis());
    b.putInt(Input.KEY_TYPE, Input.Type.CELL.toInt());
    post(b);
    postResults(b, nciList);
    scheduleNextStart();
}

From source file:android_network.hetnet.vpn_service.Util.java

public static String getPhoneTypeName(int phoneType) {
    switch (phoneType) {
    case TelephonyManager.PHONE_TYPE_NONE:
        return "None";
    case TelephonyManager.PHONE_TYPE_GSM:
        return "GSM";
    case TelephonyManager.PHONE_TYPE_CDMA:
        return "CDMA";
    case TelephonyManager.PHONE_TYPE_SIP:
        return "SIP";
    default:/*from  w ww.j a  v a2  s .c o m*/
        return "Unknown";
    }
}

From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.cellscanner.CellInfo.java

@SuppressWarnings("fallthrough")
private static String getRadioTypeName(int phoneType) {
    switch (phoneType) {
    case TelephonyManager.PHONE_TYPE_CDMA:
        return RADIO_CDMA;

    case TelephonyManager.PHONE_TYPE_GSM:
        return RADIO_GSM;

    default://from   w ww . j  a va 2  s.  com
        Log.e(LOG_TAG, "", new IllegalArgumentException("Unexpected phone type: " + phoneType));
        // fallthrough

    case TelephonyManager.PHONE_TYPE_NONE:
    case TelephonyManager.PHONE_TYPE_SIP:
        // These devices have no radio.
        return "";
    }
}