java
public static boolean isPlayStoreInstalled(Context context){
try {
context.getPackageManager()
.getPackageInfo(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE, 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
kotlin
fun isPlayStoreInstalled(context: Context): Boolean {
return try {
context.packageManager
.getPackageInfo(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE, 0)
true
} catch (e: PackageManager.NameNotFoundException) {
false
}
}
build.gradle
implementation 'com.google.android.gms:play-services-base:18.0.1'