To initiate a skype call through your android app please add the code mentioned below :-
Uri skypeUri = Uri.parse("skype:" + number + "?call");
in the code below helps you to make call but if you need video call then implement
Uri skypeUri = Uri.parse("skype:" + number + "?call&video=true");
- This code will open your Skype through intent.
private void initiateSkype(){
String number = "+919897910168";
Uri skypeUri = Uri.parse("skype:" + number + "?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);
boolean skypeFound = isAppInstalled(applicationContext, "com.skype.raider");
//IF your device contains Skype then only the skype will be initiated
if (skypeFound) {
applicationContext.startActivity(myIntent);}
}
- isAppInstalled method written below returns the boolean value true if the device contains the skype app else it will return false
public boolean isAppInstalled(Context context, String packageName) {
try {
context.getPackageManager().getApplicationInfo(packageName, 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
0 Comment(s)