14

Trying to launch and pass tel. no. to skype by this code from my app:

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

Skype is launched but it can't catch the number.

Blitz
  • 5,521
  • 3
  • 35
  • 53
ruben
  • 1,745
  • 5
  • 25
  • 47
  • possible duplicate of [launch skype from the app programetically - android](http://stackoverflow.com/questions/6405434/launch-skype-from-the-app-programetically-android) – Flexo Jan 14 '12 at 15:08

6 Answers6

37

This code works for me to start a call between two Skype users:

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

To find this (and others), use apktool to open up the Skype APK. Look at the AndroidManifest.xml and you'll see all the intent filters they know about. If you want to trigger one of those intent filters, you need to make an intent that will match one. Here's the intent filter that the code above is matching:

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

You get the category "android.intent.category.DEFAULT" for free from new Intent(), so all that remains is to set the action and the URI.

The intent filter for tel: URIs looks like this:

        <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>

So you set to the action and give the Intent a tel: URI and "the right thing happens". What happens is that Android finds the correct provider for the tel: URI. It might get the user's input to choose between the Phone App and Skype. The priority for Skype to handle tel: URIs zero, which is lowest. So if the Phone App is installed, it will probably get the Intent.

Jeff Allen
  • 1,391
  • 13
  • 19
17

In case you want to trigger a video call you will have to add "?call&video=true" to your Skype URI.

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

More information about Skype URIs are documented at: http://developer.skype.com/skype-uris-program/skype-uri-ref

EDIT :

Direct Skype call without any intent chooser :

If you want direct skype call without any intent chooser, add these lines in your manifest file...

               <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>
SweetWisher ツ
  • 7,296
  • 2
  • 30
  • 74
Martin
  • 326
  • 4
  • 9
  • The recent update to Skype has meant that the accepted answer no longer works without the URI extension you detail - thank you. +1 for the link to the docs too! – brandall Aug 17 '13 at 15:28
  • 1
    Updated API reference Link: https://msdn.microsoft.com/EN-US/library/office/dn745882.aspx – Abhijit Kurane Dec 21 '15 at 07:20
4

Use this code for Skype version 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);
nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Chang
  • 41
  • 1
1

With this code you will get the intent of the Skype activity not the caller activity. So you have to find the intent for the activity which has the intent filter for action CALL. But more clearly Skype uses the action android.intent.action.CALL_PRIVILEGED, so find by this filter. Just for information that caller activity is cmp=com.skype.raider.contactsync.ContactSkypeOutCallStartActivity.

duggu
  • 37,851
  • 12
  • 116
  • 113
Neeraj Nama
  • 1,562
  • 1
  • 18
  • 24
  • It's OK to use CALL because you can't call emergency numbers with Skpye; but if you want to always launch Skype, use an Intent with a specified Activity class or the user could choose another application. – molnarm Jun 20 '11 at 17:56
  • It worked! by this code: `Intent sky = new Intent("android.intent.action.CALL_PRIVILEGED"); sky.setClassName("com.skype.raider", "com.skype.raider.contactsync.ContactSkypeOutCallStartActivity"); sky.setData(Uri.parse("tel:65465446")); startActivity(sky);` – ruben Jun 20 '11 at 18:47
  • That's only for skype out. See my answer for a more complete solution. – Jeff Allen Jan 13 '12 at 00:02
  • @ruben What is the code of ContactSkypeOutCallStartActivity ? – Rahul Kushwaha Sep 06 '18 at 06:32
0

I found that the code above did not work...

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

The commented out lines either stopped it functioning, or did nothing!

The code as presented will call Skype and arrive at a page where you can choose Skype contacts More information will be most welcome John

LPL
  • 16,827
  • 6
  • 51
  • 95
user462990
  • 5,472
  • 3
  • 33
  • 35
0

Skype 2.X has significantly different manifest then Skype 1.X. There is no ContactSkypeOutCallStartActivity there. New manifest contains code:

<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>

So you should write:

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

Please note, that this method doesn't allow you to start call/chat using Skype. It works with Skype Out only.

dvpublic
  • 657
  • 8
  • 8