Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fire an event when or before the phone rings?

On blackberries, are there any exposed events that you can hook into that occur just before and after the phone rings?

e.g. could you override the ring setting on the fly and NOT have it ring if the number is 999-9999?

like image 878
Blankman Avatar asked Jun 29 '09 19:06

Blankman


1 Answers

Yes very possible. You need to hook into the "Phone Events" and create a phone listener. The docs give some hints on this. so fire up your favorite Java IDE and rock on!

http://na.blackberry.com/eng/deliverables/1076/development.pdf (look around page 190)

Listen for phone events.     >Implement the PhoneListener interface.
Register the phone listener. >Invoke Phone.addPhoneListener().
Remove a phone listener.     >Invoke removePhoneListener().

When a new call arrives it uses the callIncoming(int) callback. There are a bunch more:

    A call is added to a conference call.
    callAdded(int)

    A BlackBerry® device user answers a call (user driven).
    callAnswered(int)

    A conference call is established.
    callConferenceCallEstablished(int)

    The network indicates a connected event (network driven).
    callConnected(int)

    A direct-connect call is connected.
    callDirectConnectConnected(int)

    A direct-connect call is disconnected.
    callDirectConnectDisconnected(int)

    A call is disconnected.
    callDisconnected(int)

    A BlackBerry device user ends the call.
    callEndedByUser(int)

    A call fails.
    callFailed(int, int)

    A new call arrives.
    callIncoming(int)

    The BlackBerry device initiates an outgoing call.
    callInitiated(int)

    A call is removed from a conference call.
    callRemoved(int)

    A held call resumes.
    callResumed(int)

    A call is waiting.
    callWaiting(int)

    A conference call is ended (all members are disconnected).
    conferenceCallDisconnected(int)
like image 192
Byron Whitlock Avatar answered Oct 21 '22 10:10

Byron Whitlock