java如何从Android应用程序启动Skype呼叫?
我正在尝试从我的Android应用程序启动一个Skype应用程序,传递一个电话号码。到目前为止,多亏了stackoverflow上的其他用户,我成功地启动了skype,但仍然无法传递电话号码。这是我正在使用的代码:
Intent sky = new Intent("安卓.intent.action.CALL_PRIVILEGED");
sky.setClassName("com.skype.raider",
"com.skype.raider.Main");
sky.setData(Uri.parse("tel:" + number));
Log.d("UTILS", "tel:" + number);
ctx.startActivity(sky);
发生的事情是skype启动了,但给了我一杯酒,说号码无效,并建议我添加国际前缀。 日志。d给我电话:+39。。。。。。。。(这个数字很有用,我也在用它
public static void call(String number, Context ctx) {
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + number));
ctx.startActivity(callIntent);
} catch (ActivityNotFoundException e) {
Log.e("hello安卓 dialing example", "Call failed", e);
}
}
事实上,当我转到Skype的视图进行呼叫时,我看到它是由+0组成的 因此,在我看来,我以错误的方式传递电话号码,或者传递到错误的活动中。。。。任何帮助都将不胜感激! 同时,我只想说,StackOverflow只是岩石
# 1 楼答案
看到这个答案:https://stackoverflow.com/a/8844526/819355
杰夫建议用
skype:<user name>
代替tel:<phone number>
在使用apktool对skype apk进行了一些研究之后,正如该答案中所建议的那样,我提出了以下代码,对我来说,它正在发挥作用:
# 2 楼答案
请参阅此skype文档链接Skype URI tutorial: Android apps
# 3 楼答案
调用外部应用程序时,不应包含特定类。让用户决定他/她想要使用的应用程序。这就是安卓的设计方式,它是一个比强迫人们使用软软件更好的解决方案(而且在我看来,这是一个相当缓慢、封闭且不方便的应用程序)
换句话说,只需使用Uri,skype的工作就是声明其捕获此类意图的能力
# 4 楼答案
请参阅Skype开发者:Skype URI tutorial: Android apps 还记得在url中添加“?call”。例如
没有它,Skype可能无法拨打该号码