I am trying to hide call logs from particular contact. For this I have created broadcast receiver for receive event of incoming / outgoing / missed call / call hangup.
But how can I get call details on call hangup event ?
I know we can get following 2 informations when incoming event occurs :
1) State
2) Phone Number
Now for hide contact, I need to delete entry from defalut call log database which is located in “content://call_log/calls”., and insert it inside my sqlite database.
Is there anybody who faced this kind of issue before ? Any help will be appreciated.
Thanks.
Perhaps a better approach would be to register a ContentOberver on the call log table. See this question: How to implement a ContentObserver for call logs
Whenever an update is made to the table, you could query for the phone number in question and delete the record.
Related
How to get call log history for individual contacts, incoming calls and out going calls separately and call log history for particular date in calender programmatically?
Please refer to my answer provided on this post for accessing call log history. You can get the outgoing and incoming call logs and use them accordingly
In my Android app, an Activity performs a query to get the contacts on the phone and stores them into a sqlite database. For now, this is performed only once during the first launch of the Activity because that operation takes about two seconds to execute (which is actually a lot of time)
However that workaround comes with an issue: if the phone user adds some contact my app will never be able to get them. Then, I was wondering if it was possible for my app to ´listen ´ for that event and add the contact in the database when it occurs.
Is such a thing possible?
You can do it by using ContentObserver.
You have to simply
Implement a subclass of ContentObserver
you have to register your ContentObserver to listen the change.
For more detail how to do it you can follow this article Use Android’s ContentObserver in Your Code to Listen to Data Changes
I am working on an android project. I would like to ask how to modify the last call log (phone number). I am using an incoming broadcast receiver so I know when incoming calls arrive. Need some advice. Appreciate
Your question seems like a duplicate of Delete call from call log after call end.
There is a content provider you can use to search for certain calls and delete them. Look at the question that I linked.
i'm developing an android app that retrieves the call log and store it in a text file. I'm using the ContentObserver to observe for the changes and fetch the updated entry once there is a change. I'm able to fetch the entries correctly if i get a miss call, incoming call and make an outgoing call by dialing the number from the phone book. If i make an outgoing call by clicking the number from the call log, the onChange() method is called thrice. The onChange() is called once i select the name from the call log, before making a call, such that retrieving the previous event once. Once the call is made, the outgoing event is retrieved twice, totally making three entries. Please do suggest me a solution.
Thanks!
In which URI did u register the observer. Is it android.provider.CallLog.Calls.CONTENT_URI? If so then the onChange() method will be called only once.
Also, relying in content providers is not a good idea. Refer http://android-developers.blogspot.com/2010/05/be-careful-with-content-providers.html. Instead of using content observers you can try using broadcast receiver with actions
android.intent.action.PHONE_STATE
android.intent.action.NEW_OUTGOING_CALL
I want to write an application in which every call information should be logged. Till now I can log all incoming calls by making use of PhoneStateListener but dont know how to listen outgoing calls. If anyone had worked on such issue please let me know the way how to do the same.
Thanks in advance.
Try to look at following thread
How to get Call number as well as the duration of the call made by a user in Android?
from the following thread you can fetch whether the call is incomng or outgoing or missed
// type can be: Incoming, Outgoing or Missed
int typeColumn = c.getColumnIndex(android.provider.CallLog.Calls.TYPE);
Thanks