Android two ways to dial a phone without requesting permission _android

Source: Internet
Author: User

There are two ways to implement Android phone calls:

The first way to dial a phone is to jump to the Dial-up interface. The source code is as follows:

Intent Intent = new Intent (intent.action_dial);
Uri data = Uri.parse ("Tel:" + "135xxxxxxxx");
Intent.setdata (data);
StartActivity (Intent);

The second method, call directly to dial, but some third-party rom (for example: MIUI), not directly to the dial, but to the user to choose whether to dial, the source code is as follows:

Intent Intent = new Intent (intent.action_call);
Uri data = Uri.parse ("Tel:" + "135xxxxxxxx");
Intent.setdata (data);
StartActivity (Intent);

The first method does not require permission and can jump directly to the Dial-up interface.

The second approach requires that you add this permission to the Androidmenifest file: <uses-permission android:name="android.permission.CALL_PHONE" /> in Android6.0, you also need to dynamically request permissions in your code.

The above is a small set to introduce the Android without requesting permission to call the two ways, I hope to help you, if you have any questions welcome to my message, small series will promptly reply to everyone!

Related Article

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.