How to ask permission to make phone call from Android from Android version Marshmallow onwards?

前端 未结 6 1803
北海茫月
北海茫月 2020-12-31 03:33

I am trying to make a phone call from Android, and I\'ve set run time permissions as well. And it asks whether to allow making phone calls. But when I press allow, the app c

6条回答
  •  礼貌的吻别
    2020-12-31 04:00

    I would better suggest to use ACTION_DIAL rather than ACTION_CALL while constructing Intent to call a particular number . Using ACTION_DIAL , you will need no call permissions in your app, as ACTION_DIAL opens the dialer with the number already entered, and further allows the user to decide whether to actually make the call or modify the phone number before calling or not call at all.

    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + "Your Phone_number"));// Initiates the Intent 
    startActivity(intent);
    

提交回复
热议问题