Merge pull request #19 from defold/Issue-3-handle-missing-google-play-store
Handle missing google play store
This commit is contained in:
commit
4efe0c2a25
@ -17,6 +17,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@ -155,10 +156,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;
|
||||
|
||||
|
@ -11,7 +11,7 @@ height = 1136
|
||||
[android]
|
||||
input_method = HiddenInputField
|
||||
package = com.defold.extension.iap
|
||||
version_code = 3
|
||||
version_code = 5
|
||||
|
||||
[project]
|
||||
title = extension-iap
|
||||
|
@ -12,6 +12,7 @@ local items = {
|
||||
SUBSCRIPTION,
|
||||
}
|
||||
|
||||
-- mapping between product id and button name
|
||||
local item_buttons = {
|
||||
[GOLDBARS_SMALL] = "goldbars_small",
|
||||
[GOLDBARS_MEDIUM] = "goldbars_medium",
|
||||
|
Loading…
x
Reference in New Issue
Block a user