Click here to Skip to main content
16,018,442 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How my android app can detect for incoming call and then how can search in phone contact list to find if the incoming contact exists?
I want to use android API for this operations..

Thanks.
Posted
Comments
joshrduncan2012 18-Nov-13 13:28pm    
Why do you want to re-invent the wheel? That sounds like exactly what the phone actually does in terms of caller ID.
user1992 18-Nov-13 13:37pm    
For these reason, i look for these codes and i can't find it somewhere. so i can't develop my own app that rely on this operations.
After these operations i have to reject automatically the call and send a predefined message to incoming contact if it exists in my phone contact list.

Can you tell me please where can i found these codes and working with expected behavior?
joshrduncan2012 18-Nov-13 14:38pm    
--Google--
user1992 18-Nov-13 14:56pm    
I look for these source codes and i can't find more details about them.

Can you tell me please where can i found more details about how can i call them from the android's API so that i can develop new operations with them?
joshrduncan2012 18-Nov-13 15:51pm    
What have you tried so far (code-wise) to accomplish this task? Where are you stuck?

1 solution

1. use
onCallStateChanged(int state, String incomingNumber)
to get incoming phone number.refer to http://developer.android.com/reference/android/telephony/PhoneStateListener.html[^]

2. query phone number in contact database.
C#
mContext.getContentResolver().query(Contacts.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER},null, null, null);


refer to
http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Phone.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900