Open chat screen Skype from other app

萝らか妹 提交于 2020-01-14 04:57:05

问题


Developing an application, In which I have many user's account_id(skype id), Now what I want is to open chat screen of Skype (already installed in device) when I click particular User's skype_id from my application.

I did search on web but got no success Got the link how to start call on Skype but for chat?

1) Link 1

2) Link 2


回答1:


You can use the Skype URI Scheme for this (Skype:echo123?chat).

You can find out more information about the URI Scheme here : https://dev.skype.com/skype-uri

Thanks

Allen Smith Skype Developer Support Manager




回答2:


Here is the code to open Skype chat conversation:

  private void openSkype(Context context) {

  // Make sure the Skype for Android client is installed
        if (!isSkypeClientInstalled(context)) {
            goToMarket(context);

            return;
        }

        final String mySkypeUri = "skype:echo123?chat";
                    // Create the Intent from our Skype URI.
                    Uri skypeUri = Uri.parse(mySkypeUri);
                    Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);

                    // Restrict the Intent to being handled by the Skype for Android client only.
                myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
                myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        try {
                    context.startActivity(myIntent);
                } catch (Exception e) {
                    e.printStackTrace();
                }
    }

/**
     * Determine whether the Skype for Android client is installed on this device.
     */
    public boolean isSkypeClientInstalled(Context myContext) {
        PackageManager myPackageMgr = myContext.getPackageManager();
        try {
            myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
        } catch (PackageManager.NameNotFoundException e) {
            return (false);
        }
        return (true);
    }

/**
     * Install the Skype client through the market: URI scheme.
     */
    public void goToMarket(Context myContext) {
        Uri marketUri = Uri.parse("market://details?id=com.skype.raider");
        Intent myIntent = new Intent(Intent.ACTION_VIEW, marketUri);
        myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        myContext.startActivity(myIntent);
    }


来源:https://stackoverflow.com/questions/11946449/open-chat-screen-skype-from-other-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!