关于通话状态的state的监控

来源:互联网 发布:看小说的软件 编辑:程序博客网 时间:2024/05/21 06:38

    首先是获取一个call

Call fgCall = cm.getActiveFgCall();

然后是

 Call.State state = call.getState();

之后是

  switch (state) {            case DISCONNECTED:                              Connection c = call.getEarliestConnection();                              if (c != null) {                    Connection.DisconnectCause cause = c.getDisconnectCause();                    if ((cause == Connection.DisconnectCause.BUSY)                        || (cause == Connection.DisconnectCause.CONGESTION)) {                        photoImageResource = R.drawable.picture_busy;                    }                } else if (DBG) {                    log("updatePhotoForCallState: connection is null, ignoring.");                }                              break;

这里的Connection.DisconnectCause

 public enum DisconnectCause {        NOT_DISCONNECTED,               /* has not yet disconnected */        INCOMING_MISSED,                /* an incoming call that was missed and never answered */        NORMAL,                         /* normal; remote */        LOCAL,                          /* normal; local hangup */        BUSY,                           /* outgoing call to busy line */        CONGESTION,                     /* outgoing call to congested network */        MMI,                            /* not presently used; dial() returns null */        INVALID_NUMBER,                 /* invalid dial string */        NUMBER_UNREACHABLE,             /* cannot reach the peer */        SERVER_UNREACHABLE,             /* cannot reach the server */        INVALID_CREDENTIALS,            /* invalid credentials */        OUT_OF_NETWORK,                 /* calling from out of network is not allowed */        SERVER_ERROR,                   /* server error */        TIMED_OUT,                      /* client timed out */        LOST_SIGNAL,        LIMIT_EXCEEDED,                 /* eg GSM ACM limit exceeded */        INCOMING_REJECTED,              /* an incoming call that was rejected */        POWER_OFF,                      /* radio is turned off explicitly */        OUT_OF_SERVICE,                 /* out of service */        ICC_ERROR,                      /* No ICC, ICC locked, or other ICC error */        CALL_BARRED,                    /* call was blocked by call barring */        FDN_BLOCKED,                    /* call was blocked by fixed dial number */        CS_RESTRICTED,                  /* call was blocked by restricted all voice access */        CS_RESTRICTED_NORMAL,           /* call was blocked by restricted normal voice access */        CS_RESTRICTED_EMERGENCY,        /* call was blocked by restricted emergency voice access */        UNOBTAINABLE_NUMBER,            /* Unassigned number (3GPP TS 24.008 table 10.5.123) */        CDMA_LOCKED_UNTIL_POWER_CYCLE,  /* MS is locked until next power cycle */        CDMA_DROP,        CDMA_INTERCEPT,                 /* INTERCEPT order received, MS state idle entered */        CDMA_REORDER,                   /* MS has been redirected, call is cancelled */        CDMA_SO_REJECT,                 /* service option rejection */        CDMA_RETRY_ORDER,               /* requested service is rejected, retry delay is set */        CDMA_ACCESS_FAILURE,        CDMA_PREEMPTED,        CDMA_NOT_EMERGENCY,              /* not an emergency call */        CDMA_ACCESS_BLOCKED,            /* Access Blocked by CDMA network */        ERROR_UNSPECIFIED    }










0 0