This code is to msg somethone om Skype but I don\'t know how to set https://play.google.com/store/apps/details?id=com.skype.raider in case I didn\'t have Skype.
Hi Tina Please check below code its working fine.
If not install skype on device open google play otherwise open skype.
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
try {
if (appInstalledOrNot("com.skype.raider")) {
Intent sky = new Intent("android.intent.action.VIEW");
sky.setData(Uri.parse("skype:" + ""));
startActivity(sky);
} else {
Intent i = new Intent(
android.content.Intent.ACTION_VIEW);
i.setData(Uri
.parse("https://play.google.com/store/apps/details?id=com.skype.raider"));
startActivity(i);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
private boolean appInstalledOrNot(String uri) {
PackageManager pm = getPackageManager();
boolean app_installed = false;
try {
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
app_installed = true;
} catch (PackageManager.NameNotFoundException e) {
app_installed = false;
}
return app_installed;
}