Android call function

There are two ways to make a call on Android, one is to dial directly, the other is to jump to the dialing page and the user needs to manually click to dial out

. Either way, you need to make a call. Add permission settings in AndroidManifest.xml
<uses-permission android:name="android.permission.CALL_PHONE"/><!-- Call permission-->


Implementation code for dialing function
1. Manual dialing is required
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum));
startActivity(intent);


2. Dial directly (it is recommended to give a prompt before calling)
Intent intent = new Intent(Intent. ACTION_CALL, Uri.parse("tel:" + phoneNum));
startActivity(intent);

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326993459&siteId=291194637
Recommended