0
有什麼辦法來處理應用程序提升網絡信號中的不良信號問題? isee appp在像https://play.google.com/store/apps/details?id=com.bosscellular.curtis和https://play.google.com/store/apps/details?id=com.alportela.apptoola.network_booster這樣的遊戲商店,但不知道他們如何工作如何提高信號progeamically任何人知道?下面是我的代碼,它只返回網絡強度,但我想提升信號強度,我該怎麼做?如何處理應用程序或提升信號中的不良信號問題
private static final int EXCELLENT_LEVEL = 51;
private static final int GOOD_LEVEL = 50;
ProgressBar progressBar;
TextView textView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
progressBar = (ProgressBar) findViewById(R.id.signalLevel);
textView = (TextView) findViewById(R.id.signalLevelInfo);
Toast.makeText(getApplication(), "Please try again \n Your Connection Signal are Low",
Toast.LENGTH_SHORT).show();
startSignalLevelListener();
}
private void setSignalLevel(int level) {
int progress = (int) ((((float) level)/31.0) * 100);
String signalLevelString = getSignalLevelString(progress);
progressBar.setProgress(progress);
textView.setText(signalLevelString);
Log.i("signalLevel ", "" + progress);
}
private String getSignalLevelString(int level) {
String signalLevelString = "Weak";
if (level >= EXCELLENT_LEVEL)
{
signalLevelString = "High";
progressBar.getProgressDrawable().setColorFilter(Color.GREEN, Mode.OVERLAY);
}
else if (level <= GOOD_LEVEL)
{
signalLevelString = "Weak";
progressBar.getProgressDrawable().setColorFilter(Color.RED, Mode.OVERLAY);
}
return signalLevelString;
}
private void stopListening() {
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
}
private void startSignalLevelListener() {
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
int events = PhoneStateListener.LISTEN_SIGNAL_STRENGTH
| PhoneStateListener.LISTEN_DATA_ACTIVITY |
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE |
PhoneStateListener.LISTEN_SERVICE_STATE;
tm.listen(phoneStateListener, events);
}
private final PhoneStateListener phoneStateListener = new PhoneStateListener() {
@Override
public void onSignalStrengthChanged(int asu) {
setSignalLevel(asu);
super.onSignalStrengthChanged(asu);
}
};