From af87521da1c187f10b1e53f89daec9e89a6c5a30 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Tue, 12 Sep 2017 06:40:17 -0700 Subject: [PATCH] beginning of paywall. --- android/AndroidManifest.template.xml | 2 ++ android/project.clj | 14 +++++--- .../src/java/advent/core/MainActivity.java | 34 +++++++++++++++++-- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/android/AndroidManifest.template.xml b/android/AndroidManifest.template.xml index 8a1be98a..c9c79ae7 100644 --- a/android/AndroidManifest.template.xml +++ b/android/AndroidManifest.template.xml @@ -7,6 +7,8 @@ + + purchases) { + System.out.println("purchases"); + } + + public void onCreate (android.os.Bundle savedInstanceState) { + super.onCreate(savedInstanceState); try { RT.var("clojure.core", "require").invoke(Symbol.intern("clojure.core.async")); RT.var("clojure.core", "require").invoke(Symbol.intern("advent.core")); @@ -20,6 +28,26 @@ public class MainActivity extends AndroidApplication { Game game = (Game) RT.var("advent.core", "advent").deref(); initialize(game); + mBillingClient = new BillingClient.Builder(this).setListener(this).build(); + System.out.println("billing??"); + mBillingClient.startConnection(new BillingClientStateListener() { + @Override + public void onBillingSetupFinished(@BillingResponse int billingResponseCode) { + System.out.println("billing go"); + if (billingResponseCode == BillingResponse.OK) { + System.out.println("billing ok"); + // The billing client is ready. You can query purchases here. + } + } + @Override + public void onBillingServiceDisconnected() { + + System.out.println("billing disconnect"); + // Try to restart the connection on the next request to the + // In-app Billing service by calling the startConnection() method. + } + }); + } catch (Exception e) { e.printStackTrace(); }