问题
I am developing two android apps with android studio and for some reason I want just one of these apps can be installed on a device. I think I should check the package name of second app and prevent it from installing. Is there any way to do that? thanks.
回答1:
You can not prevent any app from being installation. Instead you can stop your app from being running. I mean, when your app starts, check if specific application is installed, and if so stop your application.
回答2:
An ordinary app cannot prevent another app from being installed. Malware authors would think that such a "feature" would be wonderful.
Device owner apps — mostly for IT departments at larger organizations — have some abilities here, though I forget whether they can block installation by package name.
来源:https://stackoverflow.com/questions/51223018/prevent-installing-android-app-with-specific-package-name