Sandeep Singh
Sandeep Singh

Reputation: 1127

Not able to make call using Intent Android

I am trying to make a call using intent, If i try to run this code from linux eclipse its working fine, but on windows eclipse its not working. Here is my code

Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"+"1234567890"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Upvotes: 0

Views: 165

Answers (2)

Ankii Rawat
Ankii Rawat

Reputation: 2090

Try this for calling

      Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse("tel:" + "9876543210"));
            startActivity(callIntent);

And add this permission in Manifest file

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

Upvotes: 1

Rishi Paul
Rishi Paul

Reputation: 936

Try to Use this for Windows. It may Help you

// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"
  + Uri.encode("Your Number here")));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 startActivity(intent);

Upvotes: 2

Related Questions