本文整理汇总了Java中android.telephony.TelephonyManager.PHONE_TYPE_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.PHONE_TYPE_NONE属性的具体用法?Java TelephonyManager.PHONE_TYPE_NONE怎么用?Java TelephonyManager.PHONE_TYPE_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.telephony.TelephonyManager
的用法示例。
在下文中一共展示了TelephonyManager.PHONE_TYPE_NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasGsm
/**
* Returns whether board has a builtin GSM
* @param context
*/
public static boolean hasGsm(Context context) {
TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int phoneType = manager.getPhoneType();
if (phoneType != TelephonyManager.PHONE_TYPE_NONE)
return true;
String value = SystemPropertiesProxy.get("ro.board.has_gsm", "no");
return value.equals("yes");
}
示例2: initialize
private static void initialize(Context context) {
final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
sIsPhone = (telephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE);
//sIsSipPhone = sIsPhone && SipManager.isVoipSupported(context);
Intent pIntent = getPriviledgedIntent("123");
callIntents = getPossibleActivities(context, pIntent);
PackageManager pm = context.getPackageManager();
defaultCallIntent = pm.resolveActivity(pIntent, PackageManager.MATCH_DEFAULT_ONLY);
sIsInitialized = true;
}
示例3: 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";
}
}
示例4: invalidate
@Override
public ControllerParent<PhoneShield> invalidate(
com.integreight.onesheeld.shields.ControllerParent.SelectionAction selectionAction,
boolean isToastable) {
this.selectionAction = selectionAction;
addRequiredPremission(Manifest.permission.CALL_PHONE);
addRequiredPremission(Manifest.permission.READ_PHONE_STATE);
TelephonyManager tm = (TelephonyManager) getApplication()
.getSystemService(Context.TELEPHONY_SERVICE);
if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
// No calling functionality
if (this.selectionAction != null) {
this.selectionAction.onFailure();
if (isToastable)
activity.showToast(activity.getString(R.string.phone_your_device_doesnt_have_a_sim_card));
}
} else {
if (checkForPermissions()) {
// calling functionality
if (this.selectionAction != null) {
this.selectionAction.onSuccess();
}
}else{
if (this.selectionAction != null) {
this.selectionAction.onFailure();
}
}
}
return super.invalidate(selectionAction, isToastable);
}
示例5: invalidate
@Override
public ControllerParent<SmsShield> invalidate(
com.integreight.onesheeld.shields.ControllerParent.SelectionAction selectionAction,
boolean isToastable) {
this.selectionAction = selectionAction;
TelephonyManager tm = (TelephonyManager) getApplication()
.getSystemService(Context.TELEPHONY_SERVICE);
if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
// No calling functionality
if (this.selectionAction != null) {
this.selectionAction.onFailure();
if (isToastable)
activity.showToast(activity.getString(R.string.sms_your_device_doesnt_have_a_sim_card));
}
} else {
addRequiredPremission(Manifest.permission.READ_SMS);
addRequiredPremission(Manifest.permission.SEND_SMS);
addRequiredPremission(Manifest.permission.RECEIVE_SMS);
if (checkForPermissions()) {
// calling functionality
if (this.selectionAction != null) {
this.selectionAction.onSuccess();
}
}else{
if (this.selectionAction != null) {
this.selectionAction.onFailure();
}
}
}
return super.invalidate(selectionAction, isToastable);
}
示例6: hasTelephonySupport
public static boolean hasTelephonySupport(Context con) {
// returns false if device has no phone radio (no telephony support)
if (mHasTelephonySupport != null) return mHasTelephonySupport;
try {
TelephonyManager tm = (TelephonyManager) con.getSystemService(
Context.TELEPHONY_SERVICE);
mHasTelephonySupport = (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE);
return mHasTelephonySupport;
} catch (Throwable t) {
mHasTelephonySupport = null;
return false;
}
}
示例7: isPhoneAvailable
public static boolean isPhoneAvailable(Context context) {
if(context == null){
throw new IllegalArgumentException("Context cannot be null");
}
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return telephonyManager != null && telephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}
示例8: isTablet
private boolean isTablet(Context context) {
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
return manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE;
}
示例9: 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()); // ??
}
}
}
示例10: 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);
//}
}
}
示例11: isPhone
/**
* 判断设备是否是手机
*/
public static boolean isPhone(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}
示例12: hasSIM
private boolean hasSIM(){
TelephonyManager manager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
return manager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}
示例13: isPhone
/**
* 判断设备是否是手机
*
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isPhone() {
TelephonyManager tm = (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}
示例14: isPhone
/**
* 判断设备是否是手机
*
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isPhone() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}
示例15: isPhone
/**
* 判断设备是否是手机
*
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isPhone(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm != null && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}