Hello every one! Today I posting to Skype calls and message from our application. Just we need to open explicit default installed Skype application through Intent.
1. Focus Skype (Open Skype Application)
Uri skypeUri = Uri.parse("skype:"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent);
2. Skype Chat
Uri skypeUri = Uri.parse("skype:username?chat"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent);
3. Skype Conference Chat with Topic
Uri skypeUri = Uri.parse("skype:username1;username2?chat&topic=Android%20Chat"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent);
4. Make a Skype call
Uri skypeUri = Uri.parse("skype:username?call"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent);
5. Make a Skype Video call
Uri skypeUri = Uri.parse("skype:username?call&video=true"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent);
Example code here.
MainActivity.java Class file
import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { // Make sure you are sign in skype application if you not then you need to sign in @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Open skype button click event code here ((Button) findViewById(R.id.openskype)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String mySkypeUri = "skype:"; SkypeUri(MainActivity.this, mySkypeUri); } }); // skype message button click event code here ((Button) findViewById(R.id.skypemsg)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String skypeName = ((EditText) findViewById(R.id.edt_skypeusername)).getText().toString().trim(); if(skypeName.length()<=0) { Toast.makeText(getApplicationContext(), "Please enter skype username to message", Toast.LENGTH_SHORT).show(); } else { String mySkypeUri = "skype:"+skypeName+"?chat"; SkypeUri(MainActivity.this, mySkypeUri); } } }); // Skype Audio call button click event code here ((Button) findViewById(R.id.skypecall)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String skypeName = ((EditText) findViewById(R.id.edt_skypeusername)).getText().toString().trim(); if(skypeName.length()<=0) { Toast.makeText(getApplicationContext(), "Please enter skype username to call", Toast.LENGTH_SHORT).show(); } else { String mySkypeUri = "skype:"+skypeName+"?call"; SkypeUri(MainActivity.this, mySkypeUri); } } }); // Skype Video call button click event code here ((Button) findViewById(R.id.skypevideocall)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String skypeName = ((EditText) findViewById(R.id.edt_skypeusername)).getText().toString().trim(); if(skypeName.length()<=0) { Toast.makeText(getApplicationContext(), "Please enter skype username to video call", Toast.LENGTH_SHORT).show(); } else { String mySkypeUri = "skype:"+skypeName+"?call&video=true"; SkypeUri(MainActivity.this, mySkypeUri); } } }); } public void SkypeUri(Context myContext, String mySkypeUri) { // Make sure the Skype for Android client is installed. if (!isSkypeClientInstalled(myContext)) { goToMarket(myContext); return; } Uri skypeUri = Uri.parse(mySkypeUri); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); myContext.startActivity(myIntent); return; } /** * Determine whether the Skype for Android client is installed on this device. */ 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); } /** * Install the Skype client through the market: URI scheme. */ public void goToMarket(Context myContext) { Uri marketUri = Uri.parse("market://details?id=com.skype.raider"); Intent myIntent = new Intent(Intent.ACTION_VIEW, marketUri); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); myContext.startActivity(myIntent); return; } }
activity_main.xml XML layout file Here
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="15dp" tools:context=".MainActivity" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/skype_intent_handler" android:textSize="18sp" android:textStyle="bold" /> <EditText android:id="@+id/edt_skypeusername" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:ems="10" android:hint="Echo Testing skypeID - echo123" > </EditText> <Button android:id="@+id/openskype" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Open Skype" /> <Button android:id="@+id/skypemsg" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Skype Message" /> <Button android:id="@+id/skypecall" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Skype Audio Call" /> <Button android:id="@+id/skypevideocall" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Skype Video Call" /> </LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.limbani.skypeintenthandler" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.limbani.skypeintenthandler.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Note: Make sure you sign in Skype application. If not then open Skype application and sign in.
More information about Skype URIs are documented at: developer.skype.com/skype-uris-program/skype-uri-ref
Download Tutorial APK file ClickHere
Enjoy :)
Good work. Very useful u made it in simple way.Thats working very fine and while making it i feli enjoyed and interesting.U made an awesome post.
ReplyDeleteSkype Technical Help
Thank you....:)
Deletehello .is this video call coding please tell me
Deletehello .is this video call coding please tell me
Deletecan u post code for starting video call???
ReplyDeleteHello Nithya Mohan,
DeleteI have update my post. i hope it is help you.
Thanks
thank you soo much... :) :) cn u post the manifest and string xml files of above code.....????
ReplyDeleteHello Nithya Mohan,
DeleteJust create new application on your eclipse and copy my code on your application. Add your create activity on manifest no need add more code. That's it.
thank you so much Durgesh Limbani... :) :) :) that was a great favor from your side......:):)
ReplyDeletei had run skype in background...bt still its not working...we are suposed to move to next page right after clicking each button...bt its not working.... :( :( :(
ReplyDeleteHello Nithya,
DeleteIt's work for me,
Can you tell me which error came?
when you click button then open Skype application or not?
Thanks
Hello Nathya,
DeleteI have updated my code. Please check it, I hope it's working for you now.
Thanks
hello Durgesh.....'
ReplyDeletecan u pls tell me what happens when you click each of four option in the app....?????
Thanks
Hey Nithya,
Deletefor me all above option working for me.
when m click on button then it's perform define action.(open Skype app).
Can you send me your code on mail - durgesh.android@gmail.com?
So I can check your code if possible. I can fix your issues.
Thanks
hello durgesh......
ReplyDeletei ws able to open skype with your code...bt calling and messaging dint work for me..........
thanks....
Can you show me the Manifest, Thanks.
ReplyDeleteHello, I have add menifest code now please check.
DeleteThank you
Thank you so much, I have fix the Manifest file but I don't know why have this error
Deleteandroid.content.ActivityNotFoundException: Unable to find explicit activity class {com.skype.raider/com.skype.raider.Main}; have you declared this activity in your AndroidManifest.xml?
Hello Duy,
DeleteI have not declared this "com.skype.raider/com.skype.raider.Main" activity in AndroidMenifest.xml file.
android.content.ActivityNotFoundException error came bucz Skype application not installed on your device. first install then try it.
Thanks
Thanks
Oh my fail, I test on emulator so have some error as that. Thank for the awesome post!
DeleteThis comment has been removed by the author.
DeleteOk, it work fine, but if i want have the function on skype is chat room,how to do it. Thank!
ReplyDeleteI am very happy it's work for you. Thank you
Delete"but if i want have the function on skype is chat room" you mean you want conference chat?
if yes then you use 3 point in post.
I see, thank you :)
DeleteI follow conference chat but what wrong with my code
DeleteString skypeName1=((EditText)findViewById(R.id.edt_skypeusername)).getText().toString().trim();
String skypeName2=((EditText)findViewById(R.id.edt_skypeusername2)).getText().toString().trim();
Uri skypeUri=Uri.parse("skype:"+skypeName1+", "+skypeName2+"?chat&topic=Android%20Chat");
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);
myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(myIntent);
It don't understand skypeName1 and skypeName2 :(. Thank you!
Hello Duy,
DeleteIf you want create conference chat in Skype then you need to add two or more people right?
so Skypename mean that's users skypeid. you need to add skypeid which user to need to add in conference. you must know user skypeID.
I hope now it's clear.
Thanks
Durgesh
Yes, i know that, my mean is my code wrong in
ReplyDeleteUri skypeUri=Uri.parse("skype:"+skypeName1+", "+skypeName2+"?chat&topic=Android%20Chat");
skypeName1 and skypeName2 are 2 skypeId have on my contact. Thank for replay, hope you can help me, Thank Durgesh Limbani :)
Hello Duy,
Deletejust replace "," to semicolon ";" here
Uri skypeUri=Uri.parse("skype:"+skypeName1+";"+skypeName2+"?chat&topic=Android%20Chat");
Thank you..
Ok, It work fine, it is what i need, you are very kind, thank you so much, good morning :)
Deletecan you please send the code i have tried it many times but still showing errors.. please send me i am waiting...i need it quick
DeleteHelloo Durgesh....
ReplyDeleteIs there any way to convert the data received from a bluetooth modem to skype message....???
hello Durgesh
ReplyDeletei wanted to fetch the skype contact list in my application ?? Any suggestion plz
is there a way to return to the application at the end of the call?
ReplyDeletemany thanks for your work!!
/davide
please send me whole code in zip file
ReplyDeleteif i haven't skype on my mob phone it is not work. what can i do?
ReplyDeleteHello,
DeleteI have update my post. Now first check Skype install or not in device, if not install then goto Market to install first Skype application.
Thanks.
Hi durgesh.
ReplyDeletei want to send voice stream from one android device to multiple android device via server.Can u help me on that??
hi durgesh
ReplyDeleteyou have shown only audio call between two users.But i read the skype uri api and saw that android device can't host conversation.But i need it.Actually i need to send audio streaming from one android device to multiple devices.How can i do that??will u plz write a tutorial on that??
Hi, I am getting an error while running an App Android Library Projects Can't Launch.
ReplyDeletehi, I am getting an error on logcat android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.skype.raider flg=0x10000000 }
ReplyDeletePlease test in android device.
Deletei have error on
ReplyDeleteSkypeUri(MainActivity.this, mySkypeUri);
i have error on
ReplyDeleteSkypeUri(MainActivity.this, mySkypeUri);
Is it possible to send message to skype from a phone???
ReplyDeletePlz attached all code like croping the image and clicking image with camera
ReplyDeleteIs it possible to go to the chat screen of someone, based on his contact-id or phone number? How do I get the skype-user-name from the API?
ReplyDeleteThe quality of studying from a web based math lesson will reflect in your effectiveness in solving distinct problems related to math. It is possible to apply this learning to your classroom discussions at your college.https://800support.net/sign-in/gmail-sign-in-gmail-login/
ReplyDeletecan u please help me to make video call in android studio project?
ReplyDeleteHello,
ReplyDeletei have problems with a new version of skype this code only opens skype . Can you please help me :)