2015-11-17 72 views
0

我想從我的應用程序進行視頻通話到Android的Skype,但當視頻通話結束時,我需要返回到我的動畫開始意圖。 如何做到這一點?如何在行動視圖關閉時知道意圖?

我想這

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

Skype的整合是在Android很差,它出現的唯一支持的操作是通過開放的我們從您的應用程序到Skype應用程序解析...

嘗試只使用startActivityForResult(myIntent, 0);這應該讓你迴應用程序出去後,Skype(有時這是一個回按有時兩個),但看起來onActivityResult方法實際上是在啓動應用程序本身之前調用,因此沒有好方法來處理返回到您的應用程序的任何東西。

+0

當視頻通話結束時,這不會返回到MainActivity。@ inner_class7 –

+0

@YusufÇakmak它在哪裏呢? –

+0

到skype會話頁面@ inner_class7 –