我想在我的应用程序中检测来电类型。我们可以知道来电是国内还是国际 android。
问问题
1085 次
2 回答
1
hey this is all about detect incoming or outgoing or missed call type in an android application. try this code this will definetly help you. i will answer you further on differentiating between an international and domestic call.
Cursor cur = managedQuery(CallLog.Calls.CONTENT_URI, new String[] {
CallLog.Calls._ID, CallLog.Calls.CACHED_NAME,
CallLog.Calls.NUMBER, CallLog.Calls.TYPE, CallLog.Calls.DATE },
null, null, CallLog.Calls.DATE + " DESC");
int typeIndex = cursor.getColumnIndex(CallLog.Calls.TYPE);
// Type of call retrieved from the cursor.
int type = cursor.getInt(typeIndex);
switch (type) {
case CallLog.Calls.INCOMING_TYPE:
//write your code here
break;
case CallLog.Calls.MISSED_TYPE:
break;
case CallLog.Calls.OUTGOING_TYPE:
break;
default:
break;
}
于 2012-05-09T11:56:26.867 回答
0
Can you try and get the incoming phone number and get the first couple digits. For example:+38977xxxxxx, where +389 is number from foreign country
于 2012-05-09T11:55:42.810 回答