android.telecom.Call Java Examples
The following examples show how to use
android.telecom.Call.
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 | 6 votes |
@Override public void onStateChanged(Call call, int state) { /* Call states: 1 = Call.STATE_DIALING 2 = Call.STATE_RINGING 3 = Call.STATE_HOLDING 4 = Call.STATE_ACTIVE 7 = Call.STATE_DISCONNECTED 8 = Call.STATE_SELECT_PHONE_ACCOUNT 9 = Call.STATE_CONNECTING 10 = Call.STATE_DISCONNECTING 11 = Call.STATE_PULLING_CALL */ super.onStateChanged(call, state); Timber.i("State changed: %s", state); updateUI(state); }
Example #2
Source File: CallService.java From call_manage with MIT License | 5 votes |
/** * When call has been added * * @param call */ @Override public void onCallAdded(Call call) { super.onCallAdded(call); Intent intent = new Intent(this, OngoingCallActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); CallManager.sCall = call; }
Example #3
Source File: OngoingCallActivity.java From call_manage with MIT License | 5 votes |
/** * 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 #4
Source File: CallManager.java From call_manage with MIT License | 5 votes |
/** * 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++; } }
Example #5
Source File: CallService.java From call_manage with MIT License | 4 votes |
/** * When call has been removed * * @param call */ @Override public void onCallRemoved(Call call) { super.onCallRemoved(call); CallManager.sCall = null; }
Example #6
Source File: OngoingCallActivity.java From call_manage with MIT License | 4 votes |
@Override public void onDetailsChanged(Call call, Call.Details details) { super.onDetailsChanged(call, details); Timber.i("Details changed: %s", details.toString()); }
Example #7
Source File: CallManager.java From call_manage with MIT License | 4 votes |
/** * Add a call to the current call * * @param call */ public static void addCall(Call call) { if (sCall != null) { sCall.conference(call); } }
Example #8
Source File: CallManager.java From call_manage with MIT License | 2 votes |
/** * Unregisters the Callback from the current call * * @param callback the callback to unregister */ public static void unregisterCallback(Call.Callback callback) { if (sCall == null) return; sCall.unregisterCallback(callback); }
Example #9
Source File: CallManager.java From call_manage with MIT License | 2 votes |
/** * Returnes the current state of the call from the Call object (named sCall) * * @return Call.State */ public static int getState() { if (sCall == null) return Call.STATE_DISCONNECTED; // if no call, return disconnected return sCall.getState(); }