I create a call directly using the default os dialer by:
Intent call = new Intent(Intent.ACTION_CALL);
call.setData(Uri.parse(\"tel:\" + phoneNo));
startActi
You need to know Skype package name (something like: com.skype.android), then you can start it:
PackageManager packageManager = getPackageManager();
startActivity(packageManager.getLaunchIntentForPackage("com.skype.android"));
In your case there may be bellow case happen:
For case 1 and 2 you won't able to call skype. For case 3 you can call via skype. Please check the bellow cases for start skype:
String appName = "Skype";
String packageName = "com.skype.raider";
openApp(context, appName, packageName);
public static void openApp(Context context, String appName, String packageName) {
if (isAppInstalled(context, packageName))
if (isAppEnabled(context, packageName))
context.startActivity(context.getPackageManager().getLaunchIntentForPackage(packageName));
else Toast.makeText(context, appName + " app is not enabled.", Toast.LENGTH_SHORT).show();
else Toast.makeText(context, appName + " app is not installed.", Toast.LENGTH_SHORT).show();
}
Check is app installed or not :
private static boolean isAppInstalled(Context context, String packageName) {
PackageManager pm = context.getPackageManager();
try {
pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException ignored) {
}
return false;
}
Check is app enabled or not :
private static boolean isAppEnabled(Context context, String packageName) {
boolean appStatus = false;
try {
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(packageName, 0);
if (ai != null) {
appStatus = ai.enabled;
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return appStatus;
}