Java Code Examples for android.telecom.Call#STATE_RINGING

The following examples show how to use android.telecom.Call#STATE_RINGING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OngoingCallActivity.java    From call_manage with MIT License 5 votes vote down vote up
/**
 * Updates the ui given the call state
 *
 * @param state the current call state
 */
private void updateUI(int state) {
    @StringRes int statusTextRes;
    switch (state) {
        case Call.STATE_ACTIVE: // Ongoing
            statusTextRes = R.string.status_call_active;
            break;
        case Call.STATE_DISCONNECTED: // Ended
            statusTextRes = R.string.status_call_disconnected;
            break;
        case Call.STATE_RINGING: // Incoming
            statusTextRes = R.string.status_call_incoming;
            showBiometricPrompt(this);
            break;
        case Call.STATE_DIALING: // Outgoing
            statusTextRes = R.string.status_call_dialing;
            break;
        case Call.STATE_CONNECTING: // Connecting (probably outgoing)
            statusTextRes = R.string.status_call_dialing;
            break;
        case Call.STATE_HOLDING: // On Hold
            statusTextRes = R.string.status_call_holding;
            break;
        default:
            statusTextRes = R.string.status_call_active;
            break;
    }
    mStatusText.setText(statusTextRes);
    if (state != Call.STATE_RINGING && state != Call.STATE_DISCONNECTED) switchToCallingUI();
    if (state == Call.STATE_DISCONNECTED) endCall();
    mState = state;
    mStateText = getResources().getString(statusTextRes);
    mBuilder.setContentText(mStateText);
    try {
        mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
    } catch (NullPointerException e) {
        // Notifications not supported by the device's android version
    }
}
 
Example 2
Source File: CallManager.java    From call_manage with MIT License 5 votes vote down vote up
/**
 * Ends call
 * If call ended from the other side, disconnects
 *
 * @return true whether there's no more calls awaiting
 */
public static void reject() {
    if (sCall != null) {
        if (sCall.getState() == Call.STATE_RINGING) {
            sCall.reject(false, null);
        } else {
            sCall.disconnect();
        }
        if (sIsAutoCalling) sAutoCallPosition++;
    }
}