0

我正在尝试开始视频通话,但每次都收到此错误

E/AndroidRuntime(668): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.phone.videocall dat=tel:xxx-xxx-xxxx (has extras) }
E/AndroidRuntime(668):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
E/AndroidRuntime(668):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
E/AndroidRuntime(668):  at android.app.Activity.startActivityForResult(Activity.java:2827)
E/AndroidRuntime(668):  at android.app.Activity.startActivity(Activity.java:2933)

这是我的代码:

Intent callIntent = new Intent("com.android.phone.videocall");
callIntent.putExtra("videocall", true);
callIntent.setData(Uri.parse("tel:" + prefs.getString("videonumber", "")));
startActivity(callIntent); 

在我的清单中,我得到了<uses-permission android:name="android.permission.CALL_PHONE"/>许可。我以为这就是你所需要的,但也许我错了。我videonumber的格式是 1-xxx-xxx-xxxx。任何帮助将不胜感激。

4

2 回答 2

0

这意味着您的手机上没有安装任何可以处理视频通话的应用程序。

这就是为什么在调用外部活动时总是很好的原因,将所有代码包装在一个try()catch{}块中,因为您不能依赖用户将安装这样一个扭结的应用程序这一事实。

于 2012-08-20T15:32:35.963 回答
0

虽然try-catch可行,但我建议使用现有的 Android 工具来检查是否Intent可以处理隐式:

if (callIntent.resolveActivity(getPackageManager()) != null) {
    // Send the intent, it's safe
} else{
    // There is nothing that can handle this Intent
}
于 2018-11-09T17:53:01.590 回答