7

This question is more of a "is it possible" question.

Is it possible for Android to use a different contact list from an application when displaying the identity of an incoming caller?

So for example, if a person calls and their identity is in the apps contact list, but NOT in the internal devices contact list, i want to make the id found in the apps contact list show up on the caller id of the incoming call.

Any insight would be appreciated!

prolink007
  • 33,872
  • 24
  • 117
  • 185

2 Answers2

4

I found the solution I was looking for. I ended up just using a notification to display who was calling. I hope this helps someone else out there looking for a nice solution!

StateListener yourListener = new StateListener();
TelephonyManager yourmanager =(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
    yourmanager.listen(yourListener, PhoneStateListener.LISTEN_CALL_STATE);




class StateListener extends PhoneStateListener{
    @Override
    public void onCallStateChanged(int state, String incomingNumber) {
        super.onCallStateChanged(state, incomingNumber);
        switch(state){
            case TelephonyManager.CALL_STATE_RINGING:
                //do what you want with the incoming number here:
                break;
            case TelephonyManager.CALL_STATE_OFFHOOK:

                break;
            case TelephonyManager.CALL_STATE_IDLE:

                break;

        }
    };


public void onDestroy() {

}
}
  • How did it solve your original question? About showing contact info from other app in the incoming-call screen? From this code, ok, you can catch the incoming call, but how do you display info on the screen? – Zoli Dec 11 '14 at 16:46
3

I think it's possible with broadcast receiver. Here some similar question Call block, Taking complete control of phone, is it possible and another open source app called Intent Intercept. I give you call blocking link so you can catch number, direct to your app and block normal dialer

Community
  • 1
  • 1
Trung Nguyen
  • 7,442
  • 2
  • 45
  • 87
  • Thanks for the links! I used them to get a nice clean response that I was looking for. I will share it below! –  Aug 10 '12 at 12:28
  • Actually used more of the first one to do what I needed, but Still applies. Thanks! –  Aug 10 '12 at 17:55