Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Intent.ACTION\调用会立即终止某些设备上的调用_Android_Android Intent - Fatal编程技术网

Android Intent.ACTION\调用会立即终止某些设备上的调用

Android Intent.ACTION\调用会立即终止某些设备上的调用,android,android-intent,Android,Android Intent,“我的应用”通过服务发送时,会按以下方式生成呼叫: Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + getPhoneNumber()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | intent.FLAG_ACTIVITY_MULTIPLE_TASK); ge

“我的应用”通过服务发送时,会按以下方式生成呼叫:

Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + getPhoneNumber());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    getContext().startActivity(intent);
它具有以下权限:

<uses-permission android:name="android.permission.CALL_PHONE"/>

有什么想法吗?

要打开拨号器应用程序,用户必须按下拨号器应用程序内的呼叫按钮;无需其他权限即可使用:

String number = "9999999999";
Uri call = Uri.parse("tel:" + number);             
Intent surf = new Intent(Intent.ACTION_DIAL, call); 
startActivity(surf);
要打开拨号器应用程序并自动拨打电话,需要android.permission.call\u手机使用:

 String number = "9999999999";
    Uri call = Uri.parse("tel:" + number);             
    Intent surf = new Intent(Intent.ACTION_CALL, call); 
    startActivity(surf);

您是否从BroadcastReceiver.onReceive内开始呼叫? 我也遇到了同样的问题,似乎当接收器终止时,它会用它来关闭呼叫。。。 这对我很有用:

            Intent callIntent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:" + phone));
            callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            context.startActivity(callIntent);
                            try {
                                Thread.sleep(5000);
                            } catch (InterruptedException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }

这正是我在“动作呼叫”部分所做的,但在某些设备上,它会打开拨号器并立即关闭拨号器,这是不确定的,只是有时。
            Intent callIntent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:" + phone));
            callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            context.startActivity(callIntent);
                            try {
                                Thread.sleep(5000);
                            } catch (InterruptedException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }