首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从我的应用程序启动Skype聊天屏幕?

如何从我的应用程序启动Skype聊天屏幕?
EN

Stack Overflow用户
提问于 2014-06-02 05:39:38
回答 1查看 1.2K关注 0票数 0

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

Open chat screen Skype from other app

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

上面的教程解释了如何打开App.But,我无法找到如何传递我的Skype ID并启动聊天屏幕。

有什么办法吗?如果有办法怎么做呢?

编辑

我遵循了下面的solution.It,刚刚打开了skype应用程序,但是它没有加载聊天screen.Can,你告诉我我在哪里做错了吗?

代码语言:javascript
复制
   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);
        }

        }
EN

回答 1

Stack Overflow用户

发布于 2014-06-02 08:11:39

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

代码语言:javascript
复制
skype:<insert your SkypeName>?chat

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

Allen Smith项目经理Skype Developer / Skype TX Lync Partner Engineering

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23987938

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档