<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
public void MakeCall(String number) {
// TODO Auto-generated method stub
try {
// set the data
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+number));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(callIntent);
}catch(Exception e) {
Toast.makeText(ctx,"Your call has failed...",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
Comments
Post a Comment