我想知道通過編碼啓用和禁用黑莓網絡連接的方式。禁用和啓用黑莓網絡
編輯
protected void disableConnection() {
activeConn = RadioInfo.getActiveWAFs();
if(activeConn == 0){
activeConn = RadioInfo.getEnabledWAFs();
}
mystore.setContents(new Integer(activeConn));
mystore.commit();
Radio.deactivateWAFs(activeConn);
Dialog.alert("Off internet");
}
protected void enableConnection() {
if(RadioInfo.getState() == RadioInfo.STATE_ON){
Dialog.alert("Internet on already");
}else if(mystore.getContents() != null){
if(Radio.activateWAFs(Integer.parseInt(mystore.getContents().toString())) == true){
Dialog.alert("On Internet");
}else{
Dialog.alert("Unable to on internet");
}
}else{
Dialog.alert("Unable to on internet");
}
}
這兩種方法,我上依次調用和關閉按鈕的點擊。
對於檢查互聯網是否關閉然後爲此,你喜歡這個CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT); –