简体   繁体   English

如何在Andorid 6.0中直接拨出号码而没有选择器弹出窗口

[英]How to dial a number out without chooser popup in directly in andorid 6.0

I am trying to dial a phone number out in android 6.0. 我正在尝试在android 6.0中拨出电话号码。 I can dial a phone number out using marshmallow permission. 我可以使用棉花糖权限拨出电话号码。 but when I tap on the dial button, chooser dialog popup for selecting whether dial app or skype app. 但是当我点击拨号按钮时,弹出选择器对话框,以选择是拨号应用程序还是Skype应用程序。

So I added a code "intent.setPackage'com.android.phone'", app worked well in android 5.x , but unfortunately app crashed in android 6.0. 所以我添加了一个代码“ intent.setPackage'com.android.phone'”,该应用在android 5.x中运行良好,但不幸的是,该应用在android 6.0中崩溃了。

How to dial a number out without chooser popup in directly in android 6.0 如何在Android 6.0中直接拨出号码而没有选择器弹出窗口

You can see permission code here. 您可以在此处查看许可代码。

 if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
        // Here, thisActivity is the current activity
        if (ContextCompat.checkSelfPermission(AppointmentDetailActivity.this,
                Manifest.permission.CALL_PHONE)
                != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(AppointmentDetailActivity.this,
                    new String[]{Manifest.permission.CALL_PHONE},
                    PERMISSIONS_REQUEST_CALL_PHONE);
        }
        return;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM