In one of my apps, I would like to detect if the user has got another app of mine installed.
This code works:
PackageManager pm = mAppContext.getPackageManager();
try {
pm.getPackageInfo("com.example.packagename", PackageManager.GET_ACTIVITIES);
// do something
} catch (PackageManager.NameNotFoundException e) {
// nothing to do
}
But I wonder how I can verify that the user has genuinely downloaded the app from Google Play. I guess it would be possible to install a non genuine package with the same package name, right?