Reputation: 1562
I want to detect incoming call type in my application.can we know incoming call is domestic or international in android.
Upvotes: 0
Views: 1150
Reputation: 104
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;
}
Upvotes: 1
Reputation: 587
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
Upvotes: 0