I\'m very much a beginner at this and I\'m struggling to get this to work.
When button is pressed, I simply want the dialer to open with the specified number automa
Make sure you have added the
<uses-permission android:name="android.permission.CALL_PHONE" />
tag at a correct level in the AndroidManifest.xml file (outside the
<application ... />
tag but within the <manifest ... />
tag):
Add the following in the manifest file and it should work fine -
<uses-permission android:name="android.permission.CALL_PHONE"/>
String number = "12345678";
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" +number));
startActivity(intent);
You need to add this Permission to your manifest.
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
i think you Must add <uses-permission android:name="android.permission.CALL_PHONE" />
in Manifest.
If you want the dialer to open with the number use ACTION_DIAL
Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + phoneno));
You do not need any permission
Try this.
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneno)));
Also, add the permission android.permission.CALL_PHONE
in your manifest
file.