Example usage for android.content Intent ACTION_DIAL

List of usage examples for android.content Intent ACTION_DIAL

Introduction

In this page you can find the example usage for android.content Intent ACTION_DIAL.

Prototype

String ACTION_DIAL

To view the source code for android.content Intent ACTION_DIAL.

Click Source Link

Document

Activity Action: Dial a number as specified by the data.

Usage

From source file:Main.java

public static String getCallerPackageName(Context context) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent,
            PackageManager.MATCH_DEFAULT_ONLY);
    return resolveInfo.activityInfo.packageName;
}

From source file:Main.java

public static void goDial(Context context, String dial_number) {
    Intent phonepassIntent = new Intent();
    phonepassIntent.setAction(Intent.ACTION_DIAL);
    phonepassIntent.setData(Uri.parse("tel:" + dial_number));
    context.startActivity(phonepassIntent);
}

From source file:Main.java

public static void dial(Context ctx, String telephone) {
    try {/*from www .  j  ava 2  s.  co m*/
        if (telephone != null && !telephone.equals("")) {
            Uri uri = Uri.parse("tel:" + telephone);
            Intent intent = new Intent(Intent.ACTION_DIAL, uri);
            ctx.startActivity(intent);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:Main.java

public static void forwardToDial(Activity activity, String phoneNumber) {
    if (activity != null && !TextUtils.isEmpty(phoneNumber)) {
        activity.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
    }//w  ww .j  a  v  a2s . co  m
}

From source file:com.jay.util.PhoneUtil.java

/**
 * ??/* ww  w. jav  a 2s . c om*/
 *
 * @param context     
 * @param phoneNumber ??
 */
public static void callPhones(Context context, String phoneNumber) {
    if (phoneNumber == null || phoneNumber.length() < 1) {
        return;
    }
    Uri uri = Uri.parse("tel:" + phoneNumber);
    Intent intent = null;
    //??????
    if (ActivityCompat.checkSelfPermission(context,
            Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
        intent = new Intent(Intent.ACTION_DIAL, uri);
    } else {
        intent = new Intent(Intent.ACTION_CALL, uri);
    }
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:com.android.common.util.IntentUtils.java

/**
 * Open dial with a number//from w  w  w . jav  a 2 s  . c om
 *
 * @param context
 * @param number
 */
public static void openDial(Context context, String number) {
    Uri uri = Uri.parse("tel:" + number);
    Intent intent = new Intent(Intent.ACTION_DIAL, uri);
    context.startActivity(intent);
}

From source file:library.artaris.cn.library.utils.SystemUtils.java

/**
 * ?/*  w w w.ja  v a 2s.  c o m*/
 * @param activity
 * @param phoneNumber
 */
public static void forwardToDial(Activity activity, String phoneNumber) {
    if (activity != null && !TextUtils.isEmpty(phoneNumber)) {
        activity.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
    }
}

From source file:com.pimp.instincts.activities.HospitalityActivity.java

public void contactClick1(View view) {
    startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+91 97 90 088471")));
}

From source file:com.fanfou.app.opensource.util.IntentHelper.java

public static void startDialer(final Context context, final String phoneNumber) {
    try {//from  w  ww.j a va  2 s. c om
        final Intent dial = new Intent();
        dial.setAction(Intent.ACTION_DIAL);
        dial.setData(Uri.parse("tel:" + phoneNumber));
        context.startActivity(dial);
    } catch (final Exception ex) {
        Log.e(IntentHelper.TAG, "Error starting phone dialer intent.", ex);
        Toast.makeText(context, "Sorry, we couldn't find any app to place a phone call!", Toast.LENGTH_SHORT)
                .show();
    }
}

From source file:com.pimp.instincts.activities.HospitalityActivity.java

public void contactClick2(View view) {
    startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+91 96 98 406000")));
}