如何在关闭时了解动作视图的意图?

时间:2015-11-17 20:06:48

标签: android android-intent

我正在尝试从我的应用程序进行视频通话以在Android中进行skype但是当视频通话结束时,我需要返回我的avtivity,它启动了意图。 怎么做到这一点?

我试过这个

public class MainActivity extends AppCompatActivity {

private Button btnSkypeCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btnSkypeCall = (Button) findViewById(R.id.btnCallSkype);

    btnSkypeCall.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(isSkypeClientInstalled(MainActivity.this)){

                Uri skypeUri = Uri.parse("skype:username?call&video=true");
                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 because you've already established the
                // presence of its handler (although there is an extremely minute window where that
                // handler can go away).
                startActivity(myIntent);
            }
            else{
                Toast.makeText(getApplicationContext(), "Skype is not found!", Toast.LENGTH_LONG).show();
            }
        }
    });
}

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

但我找不到任何可以退回申请的内容。

1 个答案:

答案 0 :(得分:1)

Android上的Skype整合非常糟糕,似乎唯一支持的操作是将Uri从你的应用程序传递到skype应用程序...

尝试使用startActivityForResult(myIntent, 0);这可以让你在外出skype之后回到应用程序中(有时这是一个有时候的两个),但是看起来onActivityResult方法实际上是在启动之前调用的应用程序本身,因此没有好的方法来处理返回到您的应用程序中的任何内容。