处理来电的机器人编程机器人

2023-09-04 06:13:21 作者:爱于情的交际

我要处理来电android平台。 其实我想设定一个时间段中, 如果我的手机收到来电后自动 消息发送给每个人。

i want to handle incoming call android platform. actually i want to set a time duration in which if my cell phone receive any call then automatically a message send to each of them.

请帮我。

推荐答案

喜只是扩展乌尔班PhoneStateListener并覆盖onCallStateChanged方法和样本code如下

hi Just extend ur class to PhoneStateListener and override onCallStateChanged method and sample code follows

class myCallListener extends PhoneStateListener{

        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
            // TODO Auto-generated method stub
            switch (state) {
            case TelephonyManager.CALL_STATE_RINGING:
                    // your logic here
                break;

            default:
                break;
            }

            super.onCallStateChanged(state, incomingNumber);

        }
    }