来自Intent的Skype聊天界面

7

我想创建一个启动Skype与特定联系人会话的意图。尽管我在stackoverflow上找到了相关资料,但仍无法使其正常工作。以下是我的代码:

String skypeUri = "skype:name?chat";
Intent intent = new Intent();
intent.setData(Uri.parse(skypeUri));
                intent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);

我的意图过滤器:

            <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.LAUNCHER" />
            <data android:scheme="skype" />
        </intent-filter>

它会跳转到Skype,但只能打开主页面,没有打开任何对话。 需要帮助,请告诉我。
2个回答

3

只需使用以下代码

Intent skypeIntent = new Intent("android.intent.action.VIEW");
skypeIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
skypeIntent.setData(Uri.parse("skype:" + skypeId + "?chat"));

1

假设这是您的确切代码,问题在于您没有传递您想要呼叫的人的用户名。您只有'name',而应该是他们的用户名。您需要像这样的内容:

String skypeUri = "skype:"+username+"?chat";

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接