calling from your android application

3
Calling from YOUR Android Application Posted by Amit Saini New 0 0 0 0 0 If you are developing an application for a business that provides phone support, why not build that capability directly into the application? For example, suppose the user is currently using your application and needs to make a call to the company for help; in this case, your application can directly dial the phone number. This recipe shows you how. To enable users to dial a phone number directly from your application, you can use an Intent object by passing it the ACTION_DIAL action, together with the URI in the following format: tel:<phone_number>: 1 2 3 4 <span style="font-size:16px;">package net.learn2develop.makecalls; import android.app.Activity; import android.content.Intent; import android.net.Uri;

Upload: savitaoodles

Post on 06-Nov-2015

218 views

Category:

Documents


3 download

DESCRIPTION

Dialling of the phone number from android application, thats usually need much more applications.http://www.oodlestechnologies.com/blogs/Calling-from-YOUR-Android-Application

TRANSCRIPT

Calling from YOUR Android ApplicationPosted by Amit Saini New 0 0 0 0 0If you are developing an application for a business that provides phone support, why not build that capability directly into the application? For example, suppose the user is currently using your application and needs to make a call to the company for help; in this case, your application can directly dial the phone number. This recipe shows you how. To enable users to dial a phone number directly from your application, you can use an Intent object by passing it the ACTION_DIAL action, together with the URI in the following format: tel:: 1234567891011121314package net.learn2develop.makecalls;import android.app.Activity;import android.content.Intent; import android.net.Uri;import android.os.Bundle;public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String phoneNumber = "+13175723496"; Intent i = new Intent(android.content.Intent.ACTION_DIAL, Uri.parse("tel:+" + phoneNumber)); startActivity(i); }}

The preceding code snippet causes the Phone application to dial the specified number. To place the call, the user needs to physically press the call button. If you want the Phone application to directly place the call for users without waiting for them to press the call button, you can instead use the ACTION_CALL action: 123Intent i = new Intent(android.content.Intent.ACTION_CALL,Uri.parse("tel:+" + phoneNumber)); startActivity(i);

Note that if your application is placing a call directly, you need to add the CALL_PHONE permission to your AndroidManifest.xml file: THANKSVISIT:- http://www.oodlestechnologies.com/blogs/Calling-from-YOUR-Android-Application