Android make phone calls to Android call

Source: Internet
Author: User

<!--add permission to call outside   -->      <uses-permission android: Name= "Android.permission.CALL_PHONE" ></uses-permission>          //  Check if permissions are granted (Android6.0 runtime permissions)                  if  (Contextcompat.checkselfpermission (mainactivity.this,                          manifest.permission.call_phone)  != packagemanager.permission_granted) {                      //  not authorized to apply for authorization                      if  (Activitycompat.shouldshowrequestpermissionrationale ( Mainactivity.this,                             manifest.permission.call_phone))  {                          //  return value://                            If the app has previously requested this permission, the user rejects,  this method will return true.//                             If the user previously denied permission, tick the "Don ' t ask again" option in the dialog box, Then this method will return false.//                            If the device policy prohibits the app from owning this permission,  This method also returns false.                         //  The popup needs to explain why this permission is required, and request authorization again                          toast.maketext (mainactivity.this,  "please authorize! ",  toast.length_long). Show ();                         //  help jump to the app's settings screen and let users manually authorize                           intent intent = new intent (Settings.ACTION_APPLICATION_ Details_settings);                         uri uri = uri.fromparts ("Package",  Getpackagename (),  null);                          intent.setdata (URI);                         startactivity (Intent);                      }else{                         //  does not need to explain why this permission is required, direct request authorization                           activitycompat.requestpermissions (mainactivity.this,                                  new string[]{manifest.permission.call_phone},                                  my_permissions_request_call_phone);                     }                 }else {                     //  has been authorized to call                                    // Start the call with intent Intent intent = new intent (Intent.action_call, uri.parse ("Tel:"  +  mobile)); StartActivity (intent);nbsp;               } 


This article is from the "Java" blog, so be sure to keep this source http://10594050.blog.51cto.com/10584050/1886211

Android make phone calls to Android call

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.