Search This Blog

Tuesday, 15 May 2012

How to use Phone listener in blackberry

Hello friends,
              Here is the thing, when you want to do something on network activity like incoming call , outgoing call countered:

CODE:

First step : implement "PhoneListener" on your screen

ex: public MyScreen extends MainScreen implements PhoneListener{
....
....
....
...
Phone.addPhoneListener(this);
}
    public void callAdded(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callAnswered(int callId) {
    Do Something//       
    }



    public void callConferenceCallEstablished(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callConnected(int callId) {
               // TODO Auto-generated method stub
    }



    public void callDirectConnectConnected(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callDirectConnectDisconnected(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callDisconnected(int callId) {
     // TODO Auto-generated method stub
       
    }



    public void callEndedByUser(int callId) {
       
         // TODO Auto-generated method stub
    }



    public void callFailed(int callId, int reason) {
        // TODO Auto-generated method stub
       
    }



    public void callHeld(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callIncoming(int callId) {
       
       
      // TODO Auto-generated method stub
       
    }



    public void callInitiated(int callid) {
        _reason = "Outgoing Call";
        _i=1;
    }



    public void callRemoved(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callResumed(int callId) {
        // TODO Auto-generated method stub
       
    }



    public void callWaiting(int callid) {
        // TODO Auto-generated method stub
       
    }



    public void conferenceCallDisconnected(int callId) {
        // TODO Auto-generated method stub
       
    }
}

No comments:

Post a Comment