Search code examples
androidandroid-intenturiphone-call

Why I can't call using the Uri class?


I am using following code to make call from my android code .But it doesn't seem to work .All this code does is to display phone number in call application but it doesn't call.

Uri call=Uri.parse("tel:9008765750");//that's an example phone number
Intent ii= new Intent(Intent.ACTION_VIEW,call);
startActivity(ii);

Solution

  • Try this out

    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "Your Phone_number"));
    startActivity(intent);
    

    Permission in Manifest:

     <uses-permission android:name="android.permission.CALL_PHONE" />