【问题标题】:How to start chat screen in Skype from my app?如何从我的应用程序在 Skype 中启动聊天屏幕?
【发布时间】:2014-06-02 05:39:38
【问题描述】:

我需要使用我的应用程序中的 Skype ID 打开 Skype 聊天屏幕。我看到了一些类似的问题

Open chat screen Skype from other app

http://developer.skype.com/skype-uris/skype-uri-tutorial-android

上面的教程解释了如何打开应用程序。但我不知道如何传递我的 Skype ID 并开始聊天屏幕。

有没有办法做到这一点?如果有办法怎么办?

编辑

我遵循以下解决方案。它只是打开了 Skype 应用程序,但没有加载聊天屏幕。你能告诉我我在哪里做错了吗?

   public class About extends MainActivity implements android.view.View.OnClickListener
        {
            Button fb;
            static String TAG = "remote it";
    String mySkypeUri = "skype:aruzev?chat";

            @Override
            protected void onCreate(Bundle savedInstanceState)
            {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);
                LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View contentView = inflater.inflate(R.layout.about, null, false);
                mDrawer.addView(contentView, 0);
                fb = (Button) contentView.findViewById(R.id.fb);
                fb.setOnClickListener(this);
            }



            public void onClick(View v)
            { // TODO Auto-generated method stub
                if (v.getId() == R.id.fb)
                {
              initiateSkypeUri(getApplicationContext(), mySkypeUri));
                }
            }
    public void initiateSkypeUri(Context myContext, String mySkypeUri)
        {

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

            // 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);

            // Initiate the Intent. It should never fail since we've already
            // established the
            // presence of its handler (although there is an extremely minute window
            // where that
            // handler can go away...)
            startActivity(myIntent);
            return;
        }

        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);

            return;
        }

        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);
        }

        }

【问题讨论】:

标签: android uri chat skype


【解决方案1】:

您的变量 mySkypeURI 应该是一个字符串,如果您想开始聊天,那么该字符串应该如下所示:

skype:<insert your SkypeName>?chat

然后代码将解析该字符串并将其嵌入到意图中。

艾伦·史密斯 项目经理 Skype 开发人员/Skype TX Lync 合作伙伴工程

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-13
    • 1970-01-01
    • 1970-01-01
    • 2016-10-11
    • 2013-08-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多