mirror of
https://github.com/defold/extension-iap
synced 2025-09-27 09:02:18 +02:00
@@ -155,10 +155,24 @@ public class IapGooglePlay implements Handler.Callback {
|
||||
this.autoFinishTransactions = autoFinishTransactions;
|
||||
}
|
||||
|
||||
private static boolean isPlayStoreInstalled(Context context){
|
||||
try {
|
||||
context.getPackageManager().getPackageInfo("com.android.vending", 0);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
// NOTE: We must create Handler lazily as construction of
|
||||
// handlers must be in the context of a "looper" on Android
|
||||
|
||||
if (!isPlayStoreInstalled(activity)) {
|
||||
Log.e(TAG, "Unable to find Google Play Store (com.android.vending)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.initialized)
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user