2015-10-09 36 views
6

嘿傢伙我試圖做一個意圖,開始與某個人的Skype對話。通過遍歷整個stackoverflow,我仍然無法正常工作。這裏是我的代碼:從意圖的Skype聊天屏幕

String skypeUri = "skype:name?chat"; 
Intent intent = new Intent(); 
intent.setData(Uri.parse(skypeUri)); 
       intent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); 
       intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
       startActivity(intent); 

我的意圖過濾器:

  <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
      <data android:scheme="skype" /> 
     </intent-filter> 

它給我帶來對Skype,但既來之則主要頁面,沒有對話被打開。 任何幫助,將不勝感激。

回答

1

假設這是您的確切代碼,問題是您沒有傳遞您想要調用的人的用戶名。你的名字應該是'name'。你需要的東西,如:

String skypeUri = "skype:"+username+"?chat"; 
3

只需使用下面的代碼

Intent skypeIntent = new Intent("android.intent.action.VIEW"); 
skypeIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); 
skypeIntent.setData(Uri.parse("skype:" + skypeId + "?chat"));