-6

When an incoming call hangs up, how do you judge whether to hang up or hang up? How do I monitor the hangup button on the phone page? If you know the answer, please tell me, thank you!

Sunny
  • 9
  • 2

1 Answers1

2

In my opinion, you can NOT do this.

But looking into DisconnectCause (android.telecom.DisconnectCause), maybe here has some help.

/** Disconnected because of an unknown or unspecified reason. */
public static final int UNKNOWN = 0;
/** Disconnected because there was an error, such as a problem with the network. */
public static final int ERROR = 1;
/** Disconnected because of a local user-initiated action, such as hanging up. */
public static final int LOCAL = 2;
/**
 * Disconnected because of a remote user-initiated action, such as the other party hanging up
 * up.
 */
public static final int REMOTE = 3;
/** Disconnected because it has been canceled. */
public static final int CANCELED = 4;
/** Disconnected because there was no response to an incoming call. */
public static final int MISSED = 5;
/** Disconnected because the user rejected an incoming call. */
public static final int REJECTED = 6;
/** Disconnected because the other party was busy. */
public static final int BUSY = 7;
/**
 * Disconnected because of a restriction on placing the call, such as dialing in airplane
 * mode.
 */
public static final int RESTRICTED = 8;
/** Disconnected for reason not described by other disconnect codes. */
public static final int OTHER = 9;

Sure there are much more reasons than local or remote hang-up.

Looking into android.telecom.ConnectionService, maybe some hack way can achieve your target.

Good luck.

xingjiu
  • 389
  • 3
  • 6