How to make a phone call from your application
To enable your application to initiate a phone call, you must set permissions in the manifest file:
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.c
om/apk/res/android" - package="com.bubudsadasdas"
- android:versionCode="1"
- android:versionName="1.0">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name=".phonecalls"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MA
IN" /> - <category android:name="android.intent.category.
LAUNCHER" /> - </intent-filter>
- </activity>
- </application>
- <uses-sdk android:minSdkVersion="3" />
- <uses-permission android:name="android.permission.CALL_
PHONE"></uses-permission> - </manifest>
Now create a new activity with a call method. It should look like this:
- private void call() {
- try {
- Intent callIntent = new Intent(Intent.ACTION_CALL);
- callIntent.setData(Uri.parse("tel:123456789"));
- startActivity(callIntent);
- } catch (ActivityNotFoundException e) {
- Log.e("helloandroid dialing example", "Call failed", e);
- }
- }
What happens when you start a phone call depends, in part, on the telephone network. The number may be incorrect. The network may be busy or otherwise unavailable. The call can be interrupted. Here, however, you see no error-handling logic, except for catching and logging exceptions that can be thrown if Android's system encounters a problem when finding applications that can process Intent objects.
Now call the call :) method in an empty activity:
- import android.app.Activity;
- import android.content.ActivityNotFou
ndException; - import android.content.Intent;
- import android.net.Uri;
- import android.os.Bundle;
- import android.util.Log;
- public class phonecalls extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- call();
- }
- private void call() {
- try {
- Intent callIntent = new Intent(Intent.ACTION_CALL);
- callIntent.setData(Uri.parse("tel:123456789"));
- startActivity(callIntent);
- } catch (ActivityNotFoundException activityException) {
- Log.e("helloandroid dialing example", "Call failed", e);
- }
- }
- }

Feel free to download the complete source code from here.
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@800whitet (justin mayfield)I've just received an achievement: Terror of untidiness https://t.co/oO4KPwsg #Android #Androidgames
10 min 13 sec ago -
@Gleydsonxdd (Gleydson )I have just connected Textile Mill in My RailWay. You can get it for FREE on Android! http://t.co/MhK6XUog #android #androidgames
10 min 19 sec ago -
@hong1515 (Harry Seunghwan Hong)HP TouchPad Android kernel now in the hands of CyanogenMod team http://t.co/6FV1dxYD #android
10 min 22 sec ago -
@eddieiris67 (ed oneill)I've just received an achievement: Total Upgrade http://t.co/e7WfiRnn #Android #Androidgames
10 min 30 sec ago -
@kmj22120 (김민정)I've just received an achievement: Income Collector https://t.co/0ejBO0sY #Android #Androidgames
10 min 34 sec ago
Poll
Useful resources
Android Development Projects
- Android App wanted immediately by JoePublic
- LIST DATA PROJ by nhammoud
- Nonpublic project #1433932 by subpariq
- Alarm Android Application Design by globalheed
- Simple Album App for Android by ayfonfan
- iOS and Android photo manipulation 'Morph App' by whatwedomedia
- Onsite Software Engineers in Germany by sudhirshree
- Augmented reality by merder99
- Nonpublic project #1433560 by vobla73
- Mobile app coder needed for quick, simple app by Ergometrix




Comments
دردشة سورية دردشة
دردشة سورية
دردشة لبنانية
دردشة عراقية
شات سوري
شات لبناني
دردشة سوريا
دردشة لبنان
شات سوريا
شات لبنان
دردشة السويدي
منتديات السويدي
اغاني عراقية
صور فنانين
الرياضة العراقية
شعراء العراق
نغمات عراقية
اغاني عربية
اغاني كردية
دردشة عراقية
دردشة بنات العراق
دردشة صبايا بغداد
دردشة البصره
دردشة بغداد
دردشة بغدادية
دردشة صبايا بغداد
دردشة شباب العراق
دردشة بنات العراق
دردشة الكرادة
دردشة دمشق
دردشة بيروت
دردشة حلب
دردشة حلب
دردشة عراقية
دردشة العراق
شات عراقي
جات عراقي
دردشه عراقيه
دردشة صبايا لبنان
دردشة بنات لبنان
شات صوتي | دردشة صوتية | كلام
شات صوتي
| دردشة صوتية
|
كلام
| شات كلام
|
دردشة كلام
| دردشة صوتية
|
شات صوتي
| شات
|
Chat Voice
| ahj w,jd
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
دردشه
| دردشة
|
صوتي
| صوتية
|
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
الكلام
| دردشه صوتيه
|
]v]am w,jdm
| ]v]ai w,jdi
شات صوتي
شات صوتي
شات صوتي
Actually, ain't that computer
Actually, ain't that computer techie so I don't really understand the commands. I'm so thankful that you gave a pretty much clearer discussion on how to make phone call from my application.Anthony Cole
micheal
Thank you - the site very
Thank you - the site very very nice
شات الحب - شات مصري - شات بنات مصر - شات صوتي - دردشة مصرية - شات مصرية - شات حب - شات - دردشة - Chat - love chat - دردشة الحب
Hey i think of your blog is
Hey i think of your blog is pretty - i found it pleasant in google and I put on my list of favorites would like to see more posts from u soon.
Anotonio rogers
Hi
Anotonio rogers
Phone calls from the android coding
The coding is nice, i saw another example too from a site http://android-codes-examples. blogspot.com/2011/03/make-phon e-call-using-android-code-in.h tml
Thank you for
العاب
دليل
اختصار روابط
شات الاسكندرية
شات دمياط
شات الفيوم
شات سيناء
شات طنطا
شات بورسعيد
شات جامعة المنصورة
شات بنها
شات المنوفية
شات مدينة نصر
شات الاسماعيلية
شات جامعة عين شمس
شات الغردقة
شات ميت غمر
شات شرم الشيخ
شات جامعة حلوان
شات الزقازيق
شات الدقهلية
شات اسيوط
شات السويس
شات القاهرة
شات عين شمس
شات المعادى
شات جامعة القاهرة
شات حلوان
شات المنصورة
شات البحيرة
شات امبابة
شات شبرا
شات 6 اكتوبر
شات كفر الشيخ
شات الجيزة
شات مطروح
شات بنى سويف
شات العريش
شات سوهاج
شات اسوان
شات لاقصر
شات قنا -
شات جنوب سيناء
How to cancel a call
Can anyone help me in getting the code to cancel an incoming call. Couldnt find anything in TelephoneManager.
failing and admirable bailey
failing and admirable bailey button not acquaint this classic cardy exclusive, abundant adviser of new styles that address in fact additional you achieve chop chop for buck. shoe
These days with people always
These days with people always on the move yet wanting to carry their business with them internet on the move with your laptop is a necessity. With internet dongles you can connect to the internet anytime anywhere. Find the best deals on dongles
Many people have access to
Many people have access to Internet and use a VoIP provider like Skype to make international calls, and in fact, if you have friends and family who have a computer with Internet access, there is no reason why we have to pay anything for VoIP calls - just to be on the same VoIP network. best led tv
Need to test
I need to test it, I will let you know the minute I was able to place a call using this piece of code.
When I will finally figured it out and it was exactly as you described.
I will use it for sure in the future.
sytropin
Next on my list
Good info, I had never known how to make a call from an application. Next on my list is creating my own personal ringtone, although I know that will be a big less complicated.
Actually, ain't that computer
Actually, ain't that computer techie so I don't really understand the commands. I'm so thankful that you gave a pretty much clearer discussion on how to make phone call from my application.Anthony Cole
Doesn't need permission!
You don't need to ask for the "CALL_PHONE" permission unless you need to bypass the dialer. When you use the intent without the permission, the dialer will show the number but won't call yet, and the user can then choose to call (or save) the number.
Please help stamp out permission creep and don't ask for unnecessary ones, it discourages users from installing your application. See http://developer.android.com/r eference/android/content/Inten t.html for more information.
Cell Phone Repair
Most of the code, I have learned easily. But still, some code is confusing me. I am sure that some code is missing in it.
Cell Phone Repair
Thanks for sharing this how
Thanks for sharing this how to process. The step by step process is very easy to follow. Specifically, the numbering part make everything more clearer.Pete Frost