小编Hit*_*iya的帖子

呼叫录音,呼叫多个(重复)电话阶段并创建多个音频文件

我创建了一个服务和广播接收器来获得电话状态.

以下是我的代码:

 @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        final IntentFilter filter = new IntentFilter();
        filter.addAction(ACTION_OUT);
        filter.addAction(ACTION_IN);
        if (br_call == null) {
            br_call = new CallBr();
            registerReceiver(br_call, filter);
        }
        return super.onStartCommand(intent, flags, startId);
    }

public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(ACTION_IN)) {
                if ((bundle = intent.getExtras()) != null) {
                    state =bundle.getString(TelephonyManager.EXTRA_STATE);
                    Log.d("tag", "state ::" + state);
                    if (!wasRinging) {
                     if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                            inCall=bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
                            wasRinging = true;
                            Toast.makeText(context, "IN : " + inCall, Toast.LENGTH_LONG).show();
                        }
                    }
                    if(state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){ …
Run Code Online (Sandbox Code Playgroud)

java android call call-recording

5
推荐指数
1
解决办法
143
查看次数

标签 统计

android ×1

call ×1

call-recording ×1

java ×1