如何确定手机是挂在本地还是挂在远端?

时间:2018-04-24 01:53:40

标签: android phone-call

当有来电挂断时,您如何判断是挂机还是挂机? 如何监控电话页面上的挂断按钮? 如果您知道答案,请告诉我,谢谢!

1 个答案:

答案 0 :(得分:1)

在我看来,你不能这样做。

但是看看DisconnectCause(android.telecom.DisconnectCause),也许这里有一些帮助。

/** 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;

当然,除了本地或远程挂断之外,还有更多原因。

调查android.telecom.ConnectionService,也许一些hack方式可以实现你的目标。

祝你好运。