【问题标题】:Implement calling functionality in Android app在 Android 应用中实现呼叫功能
【发布时间】:2016-12-09 07:26:18
【问题描述】:

我需要在不使用Intent.ACTION_CALL........或现有的通话应用的情况下在android应用中实现通话功能 >.....请分享建议或演示代码

【问题讨论】:

  • 您必须使用默认应用进行通话
  • 要求我们推荐或查找书籍、工具、软件库、教程或其他场外资源的问题对于 Stack Overflow 来说是无关紧要的,因为它们往往会吸引固执己见的答案和垃圾邮件。相反,请描述问题以及迄今为止为解决该问题所做的工作。

标签: android phone-call telephony


【解决方案1】:

使用此功能

public static void makeCall(Context context, String number) {
    if (!TextUtils.isEmpty(number)) {
        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
        PackageManager manager = context.getPackageManager();
        List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
        if (infos.size() > 0) {
            context.startActivity(intent);
        } else {
            Toast.makeText(context, "Please install a dialer app", Toast.LENGTH_LONG).show();
        }
    } else {
        Toast.makeText(context, "Please add phone number to make a call", Toast.LENGTH_LONG).show();
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多