Android CallLogs Listener - android

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

Related

How to get the call waiting state of a new incoming call during a phone conversation?

Based on my requirement i need to track all incoming phone calls.
i successfully track the incoming and missed calls through broad cast receivers.
But i didn't get the call waiting state.In that state i missed to track the both incoming numbers.
If any one how to get waiting call state ,please reply me.
thanq
The actual implementation depends on the specific case, but the answer is: use PhoneStateListener and TelephonyManager in a background thread.

How can we hide call logs of specific contact in android?

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.

How to Get Outgoing call duration with Twilio Client API in Android?

I have developed Twilio SDK in my Android application. For outgoing and incoming it is worked well. But when i try to set the timer for call duration, i am unable to get the notification from the other device. Is there any method to find out the other device(Which was notified after picking the call)?
Please help me on this.
Thanks,
I'm not sure if you still need help with this or not, or I get exactly your issue.
What I'm doing is keeping the timestamp of when the call was started (incoming/outgoing) in any of the clients. Then in my activity/fragment, since I have my own callbacks for the Twilio events, as soon as I know there's a call going on, I use Chronometer which is like a TextView that automatically sets things as soon as you set a base time and start it.
get timestamp of when that call started
Chronometer.setBase(timestamp);
Chonometer.start();
So it shows the duration. Remember to have your own Twilio manager class to hold that value for you so if you leave your activity and come back, the duration will be displayed correctly.
Good luck

How to get outgoing call connected state

In my application development, I need to do vibration when outgoing call connected, but I can not get the call answered state. I have read some topic about this question, such as:
Outgoing call status
But actually, these questions not be answered correctly. Use BroadcastReceiver can only receive idle, offhook, ringing states, but no active state.
The active state defined in Call.java in internal framework, I have no idea to get this state. I did use reflection method, almost same as https://stackoverflow.com/questions/5652660/accessing-callmanager-in-android, But failed also.
I never tried with outgoing calls but with incoming calls you can play with the THREE STATES YOU'VE mentioned.
STATE_RINGING: call is ringing.
STATE_OFF_HOOK: if the previous state was RINGING, the call got connected.
STATE_IDLE: if prev state was RINGING: Call rejected. If prev state was OFF_HOOK call connected and then disconnected (i.e. completed).
I have code for this implementation for incoming calls. Since you mentioned you can access these states in outgoing calls as well, I think this should work for outgoing calls as well. If you want I can post my code.
After wondering and spending a lot of time on the net I found a way to achieve this...
Just query the call history of the device based on time of your last dialed call, fetch the duration of that call, if found greater than 0 that means your call was accepted and it works perfect.
if someone unable to get it, lets me know I will elaborate it with code.

How to trigger events after ending all calls?

I am new in android.
I want to trigger incomming and outgoing calls, and code should be executed when any call( incomming and outgoing) started and ended...
I know that BroadcastReceiver is helpful for that. But can u give me the code/idea for that..
Thanks in advance...
This question is answered many times in forum please check Is there a way on Android to intercept incoming calls/SMSes to either block/unblock it?
This might answer your question.

Categories

Resources