說明:由於結束通話**android api不是對外開放的,所以需要使用反射的方法得到撥打**的服務。
1.將android源**中的"aidl"檔案拷貝到專案中
這樣專案中會生成兩個包:android.telephony;此包中檔案為:neighboringcellinfo.aidl
com.android.internal.telephony;此包中檔案為:itelephony.aidl
2.通過反射結束通話**;**如下:
3.刪除聯絡歷史中的記錄/**
* 結束通話**
*/public void endcall() );
itelephony telephony = itelephony.stub.asinte***ce(binder);
telephony.endcall();
} catch (exception e)
}
/**
* 刪除呼叫記錄
*/public void deletecalllog(string incomingnumber) , null);
if(cursor.movetonext()));
} }
private class myobserver extends contentobserver
@override
public void onchange(boolean selfchange)
}
6.最後把整個service**貼到下面
public class addressservice extends service
/*** 服務第一次被建立的時候呼叫的方法
* 服務被初始化時呼叫的方法
*/@override
public void oncreate() }
/*** 服務停止的時候呼叫
*/@override
public void ondestroy()
private class myphonelistener extends phonestatelistener
endtime = system.currenttimemillis();
break;
case telephonymanager.call_state_ringing: // 零響狀態
//判斷number是否在黑名單中
if(dao.find(incomingnumber))
log.i(tag,"來電號碼為"+ incomingnumber);
string address = numberaddressservice.getaddress(incomingnumber);
log.i(tag,"歸屬地為"+ address);
showlocation(address);
//獲取當前系統的時間
starttime = system.currenttimemillis();
break;
case telephonymanager.call_state_offhook: //接通**狀態
break;
}}
} /**
* 在窗體上顯示出來位置資訊
* @param address
*/public void showlocation(string address) else if(1 == background)else
tv_location.settext(address);
tv_location.settextsize(24);
wmanager.addview(view, params);
} /**
* 刪除呼叫記錄
*/public void deletecalllog(string incomingnumber) , null);
if(cursor.movetonext()));
} } /**
* 結束通話**
*/public void endcall() );
itelephony telephony = itelephony.stub.asinte***ce(binder);
telephony.endcall();
} catch (exception e)
}private class myobserver extends contentobserver
@override
public void onchange(boolean selfchange)
}}
asp 檢查黑名單 黑名單驗證的突破
黑名單驗證的突破 作業系統特性 windows下對大小寫不敏感,php和php對windows來說都是一樣的。windows下,上傳的檔名中帶有test.php data會在伺服器生產乙個test.php的檔案並可以被解析。及 test.php test.php data windows下檔名結尾加...
aws 黑名單功能
如果你想授權某段ip訪問,那麼可以用安全組的白名單功能,但是安全組不提供黑名單功能。如果我們的某個服務受某個ip攻擊,那麼此時可以選擇網路acl對其進行黑名單限制,操作步驟如下 1.登入aws,選擇vpc 2.vpc裡有個網路acl,當然事先你要找到你服務對應的vpc 3.選擇編輯入站規則,入站規則...
Linux nginx 黑名單配置
進入nginx配置資料夾下,建立blacklist.conf黑名單配置檔案,編輯blacklist.conf cd usr local nginx conf touch blacklist.conf vi blacklist.conf 寫入要攔截的ip位址,儲存並退出 編輯當前目錄下nginx.co...