从应用程序以编程方式启动Skype并传递号码 – Android

尝试启动并传递电话。 没有。 从我的应用程序通过此代码的Skype:

PackageManager packageManager = getPackageManager(); Intent skype = packageManager.getLaunchIntentForPackage("com.skype.raider"); skype.setData(Uri.parse("tel:65465446")); startActivity(skype); 

Skype启动,但不能赶上号码。

此代码适用于我在两个Skype用户之间启动呼叫:

 Intent sky = new Intent("android.intent.action.VIEW"); sky.setData(Uri.parse("skype:" + user_name)); startActivity(sky); 

要find这个(和其他),使用apktool打开Skype APK。 看一下AndroidManifest.xml,你会看到他们所知道的所有意图filter。 如果你想触发其中一个意图filter,你需要制定一个意图,以匹配一个。 这是上面的代码匹配的意图filter:

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

您可以从{{new Intent()}}中免费获得“android.intent.category.DEFAULT”类别,所以只需设置操作和URI即可。

tel:URI的意图filter如下所示:

  <intent-filter android:icon="@drawable/skype_blue" android:priority="0"> <action android:name="android.intent.action.CALL_PRIVILEGED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="tel" /> </intent-filter> 

所以你设置了行动,并给意向电话:URI和“正确的事情发生”。 Android会发现tel:URI的正确提供者。 它可能会得到用户的input来select电话应用程序和Skype之间。 Skype处理tel:URIs的优先级为零,这是最低的。 所以如果电话应用程序安装,它可能会得到意图。

如果你想触发一个video通话,你将不得不在你的Skype URI中添加“?call&video = true”。

 Intent skypeVideo = new Intent("android.intent.action.VIEW"); skypeVideo.setData(Uri.parse("skype:" + "<username>" + "?call&video=true")); startActivity(skypeVideo); 

有关Skype URI的更多信息,请参阅: http : //developer.skype.com/skype-uris-program/skype-uri-ref

编辑:

直接Skype呼叫没有任何意图select器:

如果你想要没有任何意图select器的直接Skype的调用,在清单文件中添加这些行…

  <intent-filter android:icon="@drawable/skype" android:priority="0" > <action android:name="android.intent.action.CALL_PRIVILEGED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="tel" /> </intent-filter> <intent-filter> <intent-filter android:icon="@drawable/skype" android:priority="0" > <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.CALL" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="skype" /> </intent-filter> </intent-filter> 

使用此代码的Skype版本2:

 Intent skype_intent = new Intent("android.intent.action.VIEW"); skype_intent.setClassName("com.skype.raider", "com.skype.raider.Main"); skype_intent.setData(Uri.parse("skype:skypeusername")); startActivity(skype_intent); 

有了这个代码,你将获得Skype活动的意图,而不是调用者的活动。 所以你必须find具有意向filter的动作CALL的意图。 但更清楚的是Skype使用动作android.intent.action.CALL_PRIVILEGED ,所以通过这个filterfind。 仅用于调用者活动的信息是cmp=com.skype.raider.contactsync.ContactSkypeOutCallStartActivity

Skype 2.X与Skype 1.X有明显不同。 那里没有ContactSkypeOutCallStartActivity。 新的清单包含代码:

 <activity android:name="com.skype.raider.Main" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation" android:windowSoftInputMode="adjustResize"> ... <intent-filter android:icon="@drawable/skype_blue" android:priority="0"> <action android:name="android.intent.action.CALL_PRIVILEGED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="tel" /> </intent-filter> ... </activity> 

所以你应该写:

 Intent skype_intent = new Intent("android.intent.action.CALL_PRIVILEGED"); skype_intent.setClassName("com.skype.raider", "com.skype.raider.Main"); skype_intent.setData(Uri.parse("tel:65465446")); context.startActivity(skype_intent); 

请注意,这种方法不允许你使用Skype开始通话/聊天。 它只适用于Skype Out。

我发现上面的代码不起作用…

 Intent i = packageManager.getLaunchIntentForPackage("com.skype.raider"); // i.setAction("android.intent.cation.CALL_PRIVILEGED"); // i.setClassName("com.skype.raider", "com.skype.raider.contactsync.ContactSkypeOutCallStartActivity"); // i.setData(Uri.parse("tel:5551234")); startActivity(i); 

注释掉的行或者停止了它的运行,或者什么都没做!

所提供的代码将打电话给Skype,并到达一个页面,您可以selectSkype联系人更多的信息将是最受欢迎的约翰