Two implementation methods of Android calling

In Android development, it is the most basic requirement for users to make calls. As the saying goes, "all roads lead to Rome", there are many ways to make a call. Today, we provide the two most commonly used.

First of all, making a call is a costly operation for users. Therefore, a certain permission is required, that is, Android permission. CALL_ For phone permission, we need to add this permission to the androidmenifest file: < uses permission Android: name = "Android. Permission. Call_phone" / >.

The first method is to make a call and jump to the dialing interface. The source code is as follows:

The operation results are as follows:

@H_ 404_ 13@

Summary: the characteristic of this method is that it goes to the dialing interface, but the actual dialing is realized by the user's click.

The second method is to make a call directly. However, some third-party ROMs (such as MIUI) do not make a call directly, but require the user to select whether to make a call. The source code is as follows:

The operation results are as follows:

@H_ 404_ 13@

Summary: the feature of this method is that it dials the number you entered directly, so this method has no direct prompt effect on users.

In conclusion, Android recommends using the first method. If it is the second method, it is recommended to add a prompt before whether to dial the number, and then confirm before dialing.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>