beginning of paywall.

This commit is contained in:
Bryce Covert
2017-09-12 06:40:17 -07:00
parent 2c4031f093
commit af87521da1
3 changed files with 42 additions and 8 deletions

View File

@@ -7,6 +7,8 @@
<uses-sdk android:minSdkVersion="15"
android:targetSdkVersion="{{target-version}}" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:name="neko.App"
android:icon="@drawable/ic_launcher"

View File

@@ -1,4 +1,4 @@
(defproject advent "1.3.1-SNAPSHOT"
(defproject advent "1.3.2-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "1.9.3" :use-resources true]
@@ -10,16 +10,19 @@
[com.badlogicgames.gdx/gdx-backend-android "1.9.3"]
[neko/neko "4.0.0-alpha5"]
[com.android.billingclient/billing "dp-1" :extension "aar"]
[org.clojure/tools.logging "0.3.1"]
[org.clojure-android/clojure "1.7.0-r4"]
[org.im4java/im4java "1.4.0"]
[org.clojure/tools.nrepl "0.2.7"]
[play-clj "0.4.5-BRYCE"]
[play-clj "0.4.6-BRYCE"]
[org.clojure/data.priority-map "0.0.5"]
[org.clojure/core.async "0.2.371"]]
:plugins [[lein-droid "0.4.4-SNAPSHOT"]]
:plugins [[lein-droid "0.4.6"]]
:repositories [["jCenter" "https://jcenter.bintray.com/"]]
:profiles {:dev {:dependencies [[android/tools.nrepl "0.2.0-bigstack"]
@@ -35,19 +38,20 @@
;; key you want to sign APKs with.
;; :keystore-path "/home/user/.android/private.keystore"
;; :key-alias "mykeyalias"
:build-type :release
:aot :all
:aot-exclude-ns [cljs.core.async.macros cljs.core.impl-ioc-macros cljs.core.impl.ioc_macros]}}}
:android {;; Specify the path to the Android SDK directory either
;; here or in your ~/.lein/profiles.clj file.
:sdk-path "/usr/local/Cellar/android-sdk/24.4.1_1/"
:sdk-path "/Users/brycecovert/dev/advent/android/sdk"
;; Uncomment this if dexer fails with OutOfMemoryException
#_#_:force-dex-optimize true
:assets-paths ["/Users/brycecovert/dev/advent/desktop/resources"]
:native-libraries-paths ["libs"]
:target-version "22" ; 18+
:target-version "24" ; 18+
:aot-exclude-ns ["clojure.parallel" "clojure.core.reducers"
"cider.nrepl" "cider-nrepl.plugin"
"cider.nrepl.middleware.util.java.parser"

View File

@@ -5,10 +5,18 @@ import clojure.lang.Symbol;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.Game;
import com.android.billingclient.api.*;
import com.android.billingclient.api.BillingClient.BillingResponse;
public class MainActivity extends AndroidApplication {
public void onCreate (android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
public class MainActivity extends AndroidApplication implements PurchasesUpdatedListener {
private BillingClient mBillingClient;
@Override
public void onPurchasesUpdated(@BillingResponse int responseCode, java.util.List<Purchase> 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();
}