当前位置: 首页>>代码示例>>Java>>正文


Java TelephonyManager.PHONE_TYPE_CDMA属性代码示例

本文整理汇总了Java中android.telephony.TelephonyManager.PHONE_TYPE_CDMA属性的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.PHONE_TYPE_CDMA属性的具体用法?Java TelephonyManager.PHONE_TYPE_CDMA怎么用?Java TelephonyManager.PHONE_TYPE_CDMA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.telephony.TelephonyManager的用法示例。


在下文中一共展示了TelephonyManager.PHONE_TYPE_CDMA属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUserCountry

public static String getUserCountry(Context context) {
    try {
        final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        final String simCountry = tm.getSimCountryIso();
        if (simCountry != null && simCountry.length() == 2) { // SIM country code is available
            Timber.i(simCountry);
            return simCountry.toLowerCase(Locale.US);
        } else if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) { // device is not 3G (would be unreliable)
            String networkCountry = tm.getNetworkCountryIso();
            if (networkCountry != null && networkCountry.length() == 2) { // network country code is available
                return networkCountry.toLowerCase(Locale.US);
            }
        }
    } catch (Exception e) {
        Timber.i(e.getMessage());
    }
    return null;
}
 
开发者ID:prakh25,项目名称:MovieApp,代码行数:18,代码来源:Utils.java

示例2: getMccMnc

public static String getMccMnc(final Context context) {
  final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  final int configMcc = context.getResources().getConfiguration().mcc;
  final int configMnc = context.getResources().getConfiguration().mnc;
  if (tm.getSimState() == TelephonyManager.SIM_STATE_READY) {
    Log.w(TAG, "Choosing MCC+MNC info from TelephonyManager.getSimOperator()");
    return tm.getSimOperator();
  } else if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
    Log.w(TAG, "Choosing MCC+MNC info from TelephonyManager.getNetworkOperator()");
    return tm.getNetworkOperator();
  } else if (configMcc != 0 && configMnc != 0) {
    Log.w(TAG, "Choosing MCC+MNC info from current context's Configuration");
    return String.format("%03d%d",
        configMcc,
        configMnc == Configuration.MNC_ZERO ? 0 : configMnc);
  } else {
    return null;
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:19,代码来源:TelephonyUtil.java

示例3: getCountry

/**
 * Get ISO 3166-1 alpha-2 country code for this device (or null if not available)
 *
 * @param context Context reference to getLinkBy the TelephonyManager instance from
 * @return country code or null
 */
public static String getCountry(Context context) {
    try {
        final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        final String simCountry = tm.getSimCountryIso();
        if (simCountry != null && simCountry.length() == 2) { // SIM country code is available
            return simCountry.toUpperCase(Locale.US);
        } else if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) { // device is not 3G (would be unreliable)
            String networkCountry = tm.getNetworkCountryIso();
            if (networkCountry != null && networkCountry.length() == 2) { // network country code is available
                return networkCountry.toLowerCase(Locale.US);
            }
        }
    } catch (Exception e) {
        Log.e(TAG, "getLinkBy country", e);
    }
    return context.getResources().getConfiguration().locale.getCountry();
}
 
开发者ID:airstep,项目名称:tubik,代码行数:23,代码来源:Tools.java

示例4: isDirectConnect

protected boolean isDirectConnect() {
  // We think Sprint supports direct connection over wifi/data, but not Verizon
  Set<String> sprintMccMncs = new HashSet<String>() {{
    add("312530");
    add("311880");
    add("311870");
    add("311490");
    add("310120");
    add("316010");
    add("312190");
  }};

  return ServiceUtil.getTelephonyManager(context).getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA &&
         sprintMccMncs.contains(TelephonyUtil.getMccMnc(context));
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:15,代码来源:LegacyMmsConnection.java

示例5: getTowerValues

private int[] getTowerValues() {
	// Find new values
	TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
	// Find the location
	if (tm == null) {
		popupMsg("Could not get TelephonyManager");
		return null;
	}
	int phoneType = tm.getPhoneType();
	if (phoneType != TelephonyManager.PHONE_TYPE_CDMA) {
		popupMsg("Only CDMA is supported");
		return null;
	}
	CellLocation cl = tm.getCellLocation();
	if (cl == null) {
		popupMsg("Could not get Cell Location");
		return null;
	}
	if (!(cl instanceof CdmaCellLocation)) {
		popupMsg("Cell Location is is not a CdmaCellLocation class");
		return null;
	}
	CdmaCellLocation cdmacl = (CdmaCellLocation) cl;
	int lat = NetworkActivity.locToGoogle(cdmacl.getBaseStationLatitude());
	int lon = NetworkActivity.locToGoogle(cdmacl.getBaseStationLongitude());
	int nid = cdmacl.getNetworkId();
	int sid = cdmacl.getSystemId();
	int bid = cdmacl.getBaseStationId();
	Log.d(TAG, "  New values: " + " lat=" + lat + " lon=" + lon + " nid="
			+ nid + " sid=" + sid + " bid=" + bid);
	return new int[] { lat, lon, nid, sid, bid };
}
 
开发者ID:KennethEvans,项目名称:Misc,代码行数:32,代码来源:MapLocationActivity.java

示例6: getPhoneTypeName

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:
            return "Unknown";
    }
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:14,代码来源:Util.java

示例7: isApplicable

@Override
public boolean isApplicable(Context context) {
    final int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();
    return activePhoneType == TelephonyManager.PHONE_TYPE_CDMA;
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:5,代码来源:OtherSoundSettings.java

示例8: onCellLocationChanged

public void onCellLocationChanged(CellLocation location) {

            checkForNeighbourCount(location);
            compareLac(location);
            refreshDevice();
            mDevice.setNetID(tm);
            mDevice.getNetworkTypeName();

            switch (mDevice.getPhoneID()) {

                case TelephonyManager.PHONE_TYPE_NONE:
                case TelephonyManager.PHONE_TYPE_SIP:
                case TelephonyManager.PHONE_TYPE_GSM:
                    GsmCellLocation gsmCellLocation = (GsmCellLocation) location;
                    if (gsmCellLocation != null) {
                        //TODO @EVA where are we sending this setCellInfo data?

                        //TODO
                        /*@EVA
                            Is it a good idea to dump all cells to db because if we spot a known cell
                            with different lac then this will also be dump to db.

                        */
                        mDevice.setCellInfo(
                                gsmCellLocation.toString() +                // ??
                                mDevice.getDataActivityTypeShort() + "|" +  // No,In,Ou,IO,Do
                                mDevice.getDataStateShort() + "|" +         // Di,Ct,Cd,Su
                                mDevice.getNetworkTypeName() + "|"          // HSPA,LTE etc
                        );

                        mDevice.mCell.setLAC(gsmCellLocation.getLac());     // LAC
                        mDevice.mCell.setCID(gsmCellLocation.getCid());     // CID
                        if (gsmCellLocation.getPsc() != -1) {
                            mDevice.mCell.setPSC(gsmCellLocation.getPsc()); // PSC
                        }

                        /*
                            Add cell if gps is not enabled
                            when gps enabled lat lon will be updated
                            by function below

                         */
                    }
                    break;

                case TelephonyManager.PHONE_TYPE_CDMA:
                    CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) location;
                    if (cdmaCellLocation != null) {
                        mDevice.setCellInfo(
                                cdmaCellLocation.toString() +                       // ??
                                mDevice.getDataActivityTypeShort() + "|" +  // No,In,Ou,IO,Do
                                mDevice.getDataStateShort() + "|" +         // Di,Ct,Cd,Su
                                mDevice.getNetworkTypeName() + "|"          // HSPA,LTE etc
                        );
                        mDevice.mCell.setLAC(cdmaCellLocation.getNetworkId());      // NID
                        mDevice.mCell.setCID(cdmaCellLocation.getBaseStationId());  // BID
                        mDevice.mCell.setSID(cdmaCellLocation.getSystemId());       // SID
                        mDevice.mCell.setMNC(cdmaCellLocation.getSystemId());       // MNC <== BUG!??
                        mDevice.setNetworkName(tm.getNetworkOperatorName());        // ??
                    }
            }

        }
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:63,代码来源:CellTracker.java

示例9: onLocationChanged

/**
 * Description:    Add entries to the "DBi_measure" DB table
 *
 * Issues:
 *                  [ ]
 *
 * Notes:           (a)
 *
 *
 * TODO:  Remove OLD notes below, once we have new ones relevant to our new table
 *
 *  From "locationinfo":
 *
 *      $ sqlite3.exe -header aimsicd.db 'select * from locationinfo;'
 *      _id|Lac|CellID|Net|Lat|Lng|Signal|Connection|Timestamp
 *      1|10401|6828xxx|10|54.67874392|25.28693531|24|[10401,6828320,126]No|Di|HSPA||2015-01-21 20:45:10
 *
 *  From "cellinfo":
 *
 *      $ sqlite3.exe -header aimsicd.db 'select * from cellinfo;'
 *      _id|Lac|CellID|Net|Lat|Lng|Signal|Mcc|Mnc|Accuracy|Speed|Direction|NetworkType|MeasurementTaken|OCID_SUBMITTED|Timestamp
 *      1|10401|6828xxx|10|54.67874392|25.28693531|24|246|2|69.0|0.0|0.0|HSPA|82964|0|2015-01-21 20:45:10
 *
 *  Issues:
 *
 */
public void onLocationChanged(Location loc) {

    DeviceApi18.loadCellInfo(tm, mDevice);

    if (!mDevice.mCell.isValid()) {
        CellLocation cellLocation = tm.getCellLocation();
        if (cellLocation != null) {
            switch (mDevice.getPhoneID()) {

                case TelephonyManager.PHONE_TYPE_NONE:
                case TelephonyManager.PHONE_TYPE_SIP:
                case TelephonyManager.PHONE_TYPE_GSM:
                    GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
                    mDevice.mCell.setCID(gsmCellLocation.getCid()); // CID
                    mDevice.mCell.setLAC(gsmCellLocation.getLac()); // LAC
                    mDevice.mCell.setPSC(gsmCellLocation.getPsc()); // PSC
                    break;

                case TelephonyManager.PHONE_TYPE_CDMA:
                    CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
                    mDevice.mCell.setCID(cdmaCellLocation.getBaseStationId()); // BSID ??
                    mDevice.mCell.setLAC(cdmaCellLocation.getNetworkId());     // NID
                    mDevice.mCell.setSID(cdmaCellLocation.getSystemId());      // SID
                    mDevice.mCell.setMNC(cdmaCellLocation.getSystemId());      // MNC <== BUG!??

                    break;
            }
        }
    }

    if (loc != null &&  (Double.doubleToRawLongBits(loc.getLatitude()) != 0  &&  Double.doubleToRawLongBits(loc.getLongitude()) != 0)) {

        mDevice.mCell.setLon(loc.getLongitude());       // gpsd_lon
        mDevice.mCell.setLat(loc.getLatitude());        // gpsd_lat
        mDevice.mCell.setSpeed(loc.getSpeed());         // speed        // TODO: Remove, we're not using it!
        mDevice.mCell.setAccuracy(loc.getAccuracy());   // gpsd_accu
        mDevice.mCell.setBearing(loc.getBearing());     // -- [deg]??   // TODO: Remove, we're not using it!
        mDevice.setLastLocation(loc);                   //

        // Store last known location in preference
        SharedPreferences.Editor prefsEditor;
        prefsEditor = prefs.edit();
        prefsEditor.putString(context.getString(R.string.data_last_lat_lon),
                String.valueOf(loc.getLatitude()) + ":" + String.valueOf(loc.getLongitude()));
        prefsEditor.apply();

        // This only logs a BTS if we have GPS lock
        // Test: ~~Is correct behaviour? We should consider logging all cells, even without GPS.~~
        //if (mTrackingCell) {
            // This also checks that the lac are cid are not in DB before inserting
            dbHelper.insertBTS(mDevice.mCell);
        //}
    }
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:80,代码来源:CellTracker.java

示例10: isCDMA

private static final boolean isCDMA(Context context) {
	TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
	return telephony != null && telephony.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:4,代码来源:SettingsFactory.java


注:本文中的android.telephony.TelephonyManager.PHONE_TYPE_CDMA属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。