Class CallAction

java.lang.Object
com.codename1.call.session.CallAction

public final class CallAction extends Object

Something the system is asking the app to do to a call: the user pressed answer on the lock screen, hung up from the car, or tapped the keypad.

Why this is an object and not just a callback

Both platforms require the app to say whether it managed to do what was asked, and to say so within a few seconds. On iOS an unanswered CXAction times out and the system call UI and the app then disagree about the state of the call, permanently and with nothing in the log.

Most apps should ignore all of this: doing nothing is correct. If the listener returns without touching the action, it is fulfilled automatically. Only an app that has to do slow asynchronous work before it knows whether it can answer -- renegotiating a session, say -- needs to call defer() and then fulfill() or fail() itself.

An action that is deferred and then forgotten is failed by a safety timer rather than left to time out, because a failed action puts the system UI back in a state the user can act on, and a timed-out one does not.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Takes responsibility for answering this action later.
    void
    Reports that the app could not do what was asked, putting the system UI back into a state the user can act on.
    void
    Reports that the app did what was asked.
    The call this action is about.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCallId

      public String getCallId()
      The call this action is about.
    • defer

      public void defer()

      Takes responsibility for answering this action later.

      After calling this the listener must call fulfill() or fail(), and should do it within about three seconds. A deferred action that is never answered is failed automatically, by the timer this starts.

    • fulfill

      public void fulfill()
      Reports that the app did what was asked.
    • fail

      public void fail()
      Reports that the app could not do what was asked, putting the system UI back into a state the user can act on.