本文整理匯總了Java中android.telephony.SignalStrength.isGsm方法的典型用法代碼示例。如果您正苦於以下問題:Java SignalStrength.isGsm方法的具體用法?Java SignalStrength.isGsm怎麽用?Java SignalStrength.isGsm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.telephony.SignalStrength
的用法示例。
在下文中一共展示了SignalStrength.isGsm方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
/**
* Description: TODO: add more info
*
* Issues:
*
* [ ] Getting and comparing signal strengths between different RATs can be very
* tricky, since they all return different ranges of values. AOS doesn't
* specify very clearly what exactly is returned, even though people have
* a good idea, by trial and error.
*
* See note in : SignalStrengthTracker.java
*
* Notes:
*
*
*
*/
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// Update Signal Strength
if (signalStrength.isGsm()) {
int dbm;
if (signalStrength.getGsmSignalStrength() <= 2 ||
signalStrength.getGsmSignalStrength() == NeighboringCellInfo.UNKNOWN_RSSI) {
// Unknown signal strength, get it another way
String[] bits = signalStrength.toString().split(" ");
dbm = Integer.parseInt(bits[9]);
} else {
dbm = signalStrength.getGsmSignalStrength();
}
mDevice.setSignalDbm(dbm);
} else {
int evdoDbm = signalStrength.getEvdoDbm();
int cdmaDbm = signalStrength.getCdmaDbm();
// Use lowest signal to be conservative
mDevice.setSignalDbm((cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm);
}
// Send it to signal tracker
signalStrengthTracker.registerSignalStrength(mDevice.mCell.getCID(), mDevice.getSignalDBm());
//signalStrengthTracker.isMysterious(mDevice.mCell.getCID(), mDevice.getSignalDBm());
}
示例2: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
/**
* Description: TODO: add more info
*
* Issues:
*
* [ ] Getting and comparing signal strengths between different RATs can be very
* tricky, since they all return different ranges of values. AOS doesn't
* specify very clearly what exactly is returned, even though people have
* a good idea, by trial and error.
*
* See note in : SignalStrengthTracker.java
*/
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// Update Signal Strength
if (signalStrength.isGsm()) {
int dbm;
if (signalStrength.getGsmSignalStrength() <= 2 ||
signalStrength.getGsmSignalStrength() == NeighboringCellInfo.UNKNOWN_RSSI) {
// Unknown signal strength, get it another way
String[] bits = signalStrength.toString().split(" ");
dbm = Integer.parseInt(bits[9]);
} else {
dbm = signalStrength.getGsmSignalStrength();
}
device.setSignalDbm(dbm);
} else {
int evdoDbm = signalStrength.getEvdoDbm();
int cdmaDbm = signalStrength.getCdmaDbm();
// Use lowest signal to be conservative
device.setSignalDbm((cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm);
}
// Send it to signal tracker
signalStrengthTracker.registerSignalStrength(device.cell.getCellId(), device.getSignalDBm());
//signalStrengthTracker.isMysterious(device.cell.getCid(), device.getSignalDBm());
}
示例3: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
long now = System.currentTimeMillis();
if (signalStrength.isGsm()) {
Log.d(TAG,
"GSM Signal Strength: "
+ signalStrength.getGsmSignalStrength() + ", "
+ signalStrength.getGsmBitErrorRate());
} else {
Log.d(TAG,
"CDMA Signal Strength: " + signalStrength.getCdmaDbm()
+ ", " + signalStrength.getCdmaEcio());
}
putValueTrimSize(IS_GSM_FIELD, null, now, signalStrength.isGsm());
putValueTrimSize(GSM_SIGNAL_STRENGTH_FIELD, null, now, signalStrength.getGsmSignalStrength());
putValueTrimSize(GSM_BIT_ERROR_RATE_FIELD, null, now, signalStrength.getGsmBitErrorRate());
putValueTrimSize(CDMA_DBM_FIELD, null, now, signalStrength.getCdmaDbm());
putValueTrimSize(CDMA_ECIO_FIELD, null, now, signalStrength.getCdmaEcio());
putValueTrimSize(EVDO_DBM_FIELD, null, now, signalStrength.getEvdoDbm());
putValueTrimSize(EVDO_ECIO_FIELD, null, now, signalStrength.getEvdoEcio());
putValueTrimSize(EVDO_SNR_FIELD, null, now, signalStrength.getEvdoSnr());
}
示例4: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
long now = System.currentTimeMillis();
if (signalStrength.isGsm()) {
Log.d(TAG,
"GSM Signal Strength: "
+ signalStrength.getGsmSignalStrength() + ", "
+ signalStrength.getGsmBitErrorRate());
} else {
Log.d(TAG,
"CDMA Signal Strength: " + signalStrength.getCdmaDbm()
+ ", " + signalStrength.getCdmaEcio());
}
putValueTrimSize(IS_GSM_FIELD, null, now, signalStrength.isGsm());
putValueTrimSize(GSM_SIGNAL_STRENGTH_FIELD, null, now, signalStrength.getGsmSignalStrength());
putValueTrimSize(GSM_BIT_ERROR_RATE_FIELD, null, now, signalStrength.getGsmBitErrorRate());
putValueTrimSize(CDMA_DBM_FIELD, null, now, signalStrength.getCdmaDbm());
putValueTrimSize(CDMA_ECIO_FIELD, null, now, signalStrength.getCdmaEcio());
putValueTrimSize(EVDO_DBM_FIELD, null, now, signalStrength.getEvdoDbm());
putValueTrimSize(EVDO_ECIO_FIELD, null, now, signalStrength.getEvdoEcio());
putValueTrimSize(EVDO_SNR_FIELD, null, now, signalStrength.getEvdoSnr());
}
示例5: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
String sim = UEDevice.getSimType(activity);
mNavigationView.setSingalText(sim);
if (sim.equals("無服務")) {
mNavigationView.setSingalStatus(UISingalView.STATUS_NONE);
return;
}
mNavigationView.setSingalStatus(UISingalView.STATUS_NORMAL);
int level = 0;
if (signalStrength.isGsm()) {
level = signalStrength.getGsmSignalStrength();
}else {
if (sim.equals("中國電信")) {
level = signalStrength.getCdmaDbm();
}else {
level = signalStrength.getEvdoDbm();
}
}
if (level == 0) {
mNavigationView.setSignal(5);
return;
}
if (level < -112) {
mNavigationView.setSignal(0);
}else if (level >= -111 && level < -104) {
mNavigationView.setSignal(1);
}else if (level >= -104 && level < -97) {
mNavigationView.setSignal(2);
}else if (level >= -97 && level < -90) {
mNavigationView.setSignal(3);
}else if (level >= -90 && level < -83) {
mNavigationView.setSignal(4);
}else {
mNavigationView.setSignal(5);
}
}
示例6: isCdma
import android.telephony.SignalStrength; //導入方法依賴的package包/類
private boolean isCdma(SignalStrength signalStrength) {
return (signalStrength != null) && !signalStrength.isGsm();
}
示例7: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
if (signalStrength.isGsm()) {
if (signalStrength.getGsmSignalStrength() != 99) {
// this is the equation used to convert a valid gsm signal to dbm.
setCellSignalStrength(signalStrength.getGsmSignalStrength() * 2 - 113);
} else {
setCellSignalStrength(signalStrength.getGsmSignalStrength());
}
} else {
setCellSignalStrength(signalStrength.getCdmaDbm());
}
}
示例8: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength strength) {
super.onSignalStrengthsChanged(strength);
if(strength.isGsm()) {
mCmIf.csmif_SignalStrength(strength.getGsmSignalStrength());
}
}
示例9: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
int strength = -1;
dbm = -1024;
if (signalStrength.isGsm()) {
if (signalStrength.getGsmSignalStrength() != 99) {
dbm = signalStrength.getGsmSignalStrength() * 2 - 113;
} else {
dbm = signalStrength.getGsmSignalStrength();
}
} else {
dbm = signalStrength.getCdmaDbm();
}
oldTime = System.currentTimeMillis();
if (dbm <= -111) {
strength = 0;
} else if (dbm <= -99 && dbm >= -110) {
strength = 1;
} else if (dbm <= -86 && dbm >= -98) {
strength = 2;
} else if (dbm <= -74 && dbm >= -85) {
strength = 3;
} else if ((dbm <= -61 && dbm >= -73) || (dbm >= 60 && dbm < 99)) {
strength = 4;
} else {
viewBeforeSignal.setVisibility(View.GONE);
txtStatusSignal.setVisibility(View.GONE);
}
if (strength != -1) {
viewBeforeSignal.setVisibility(View.VISIBLE);
txtStatusSignal.setVisibility(View.VISIBLE);
txtStatusSignal.setText(getString(R.string.txtStatusSignal)
+ " " + strength + " bars");
txtStatusSignal
.setContentDescription(getString(R.string.txtStatusSignal)
+ " " + strength + " bars");
attachListener(txtStatusSignal);
}
}
示例10: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
String network = getNetwork();
if (network.equals(NETWORK_TYPES[TelephonyManager.NETWORK_TYPE_CDMA])) {
setCurrentRssi(signalStrength.getCdmaDbm());
} else if (network.equals(NETWORK_TYPES[TelephonyManager.NETWORK_TYPE_EVDO_0]) ||
network.equals(NETWORK_TYPES[TelephonyManager.NETWORK_TYPE_EVDO_A]) ||
network.equals(NETWORK_TYPES[TelephonyManager.NETWORK_TYPE_EVDO_B])) {
setCurrentRssi(signalStrength.getEvdoDbm());
} else if (signalStrength.isGsm()) {
setCurrentRssi(signalStrength.getGsmSignalStrength());
}
}
示例11: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
if (signalStrength.isGsm()) {
int asu = signalStrength.getGsmSignalStrength();
if (asu == 0 || asu == 99) {
PhoneStateUtils.signalStrength = 0;
} else if (asu < 5) {
PhoneStateUtils.signalStrength = 2;
} else if (asu >= 5 && asu < 8) {
PhoneStateUtils.signalStrength = 3;
} else if (asu >= 8 && asu < 12) {
PhoneStateUtils.signalStrength = 4;
} else if (asu >= 12 && asu < 14) {
PhoneStateUtils.signalStrength = 5;
} else if (asu >= 14) {
PhoneStateUtils.signalStrength = 6;
}
} else {
int cdmaDbm = signalStrength.getCdmaDbm();
if (cdmaDbm >= -89) {
PhoneStateUtils.signalStrength = 6;
} else if (cdmaDbm >= -97) {
PhoneStateUtils.signalStrength = 5;
} else if (cdmaDbm >= -103) {
PhoneStateUtils.signalStrength = 4;
} else if (cdmaDbm >= -107) {
PhoneStateUtils.signalStrength = 3;
} else if (cdmaDbm >= -109) {
PhoneStateUtils.signalStrength = 2;
} else {
PhoneStateUtils.signalStrength = 0;
}
}
}