Dan*_*ele 7 java android skype
我正试图从我的Android应用程序启动Skype意图,传递一个电话号码.到目前为止,感谢其他人在stackoverflow上有类似的需求,我已经设法启动Skype,但我仍然无法传递电话号码.这是我正在使用的代码:
Intent sky = new Intent("android.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);
Run Code Online (Sandbox Code Playgroud)
发生了什么事是Skype的启动,但给了我举杯说,号码无效,并建议我加国际前缀.Log.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("helloandroid dialing example", "Call failed", e);
    }
}
Run Code Online (Sandbox Code Playgroud)
事实上,当我转到Skype的视图进行呼叫时,我发现它已经被组成了+ 0所以在我看来,我是以错误的方式传递电话号码,或者是错误的活动....帮助将非常感谢!与此同时,我只想说StackOverflow只是摇滚.
mar*_*mor 17
请参阅此答案:https://stackoverflow.com/a/8844526/819355
杰夫建议使用skype:<user name>而不是tel:<phone number>
用apktool对skype apk进行了一些研究之后,按照那个回答的建议,我想出了这个代码,对我来说它正在工作:
public static void skype(String number, Context ctx) {
        try {
            //Intent sky = new Intent("android.intent.action.CALL_PRIVILEGED");
            //the above line tries to create an intent for which the skype app doesn't supply public api
                Intent sky = new Intent("android.intent.action.VIEW");
            sky.setData(Uri.parse("skype:" + number));
            Log.d("UTILS", "tel:" + number);
            ctx.startActivity(sky);
        } catch (ActivityNotFoundException e) {
            Log.e("SKYPE CALL", "Skype failed", e);
        }
    }
Run Code Online (Sandbox Code Playgroud)
        小智 7
请参阅Skype开发人员:http://developer.skype.com/skype-uris/skype-uri-tutorial-android 还要记住在您的网址中添加"?call".例如
intent.setData(Uri.parse("skype:" + phoneNumber + "?call"));
Run Code Online (Sandbox Code Playgroud)
没有它,Skype可能无法拨打该号码.
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           19187 次  |  
        
|   最近记录:  |