Android dial-up interface and direct dial phone interface code control
Define tag as null
private static final String TAG = null;
Define click events for a button
Tell.setonclicklistener (New View.onclicklistener () {
@Override
public void OnClick (View v) {
TODO auto-generated Method Stub
/* Intent Intent = new Intent (Intent.action_call, Uri.parse ("Tel:" +10086));
StartActivity (Intent); * *
Call directly
String Tel = "10086";
Call (tel);
}
});
Click the class of the event call
protected void Call (String tel) {
/*//Enter dial-up interface only, do not dial
Uri uri = Uri.parse ("Tel:" + tel);
Intent Intent = new Intent (intent.action_dial, URI);
StartActivity (Intent); */
Call directly
LOG.D (TAG, "Call:" + tel);
Uri uri = Uri.parse ("Tel:" + tel);
Intent Intent = new Intent (Intent.action_call, URI);
StartActivity (Intent);
}
Note: Add Permissions:
<uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>
<uses-permission android:name= "Android.permission.CALL_PHONE"/>
<uses-permission android:name= "Android.permission.PROCESS_OUTGOING_CALLS"/>
Android Direct dial Phone interface