I plan on publishing my app on Amazon app store as well as Google Play, and have some things in my app that need to behave slightly different depending on whether the app wa
Since samsung has not implemented the PackageManager.getInstallerPackageName(), it still returns null. So use the PackageManager.getInstalledPackages() to get all the packages and search for the samsungapp packagename "com.sec.android.app.samsungapps".
null - developer
com.android.vending - google play
com.amazon.venezia - amazon app
com.sec.android.app.samsungapps - samsung app store
// lets start with google play store link
String link = "https://play.google.com/store/apps/details?id=com.hellothupten.capital2countryquiz";
//find out the installer for your app package name.
String installer = getPackageManager().getInstallerPackageName(
"com.hellothupten.capital2countryquiz");
if (installer == null) {
List installedPackages = getPackageManager()
.getInstalledPackages(PackageManager.GET_ACTIVITIES);
for (PackageInfo p : installedPackages) {
if (p.packageName.contains("samsungapps")) {
// change to samsung app store link
link = "http://apps.samsung.com/mars/topApps/topAppsDetail.as?productId=000000840239";
break;
}
}
} else if (installer.contains("amazon")) {
// change to amazon app store link
link = "amzn://apps/android?p=com.hellothupten.capital2countryquiz";
} else if (installer.contains("samsung")) {
// change to samsung app store link. This does not
// exist..but who knows samsung may implement
// getInstallerPackageName in future, I assume it will
// contain a word samsung in its package name.
link = "http://apps.samsung.com/mars/topApps/topAppsDetail.as?productId=000000840239";
}
Use the link variable as the store link.
Update:
samsungapps://ProductDetail/com.sec.chaton
Samsung: http://developer.samsung.com/android/technical-docs/Samsung-Apps-Deeplink-Guide