aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/moe/yuuta/gplicense/Policy.java
diff options
context:
space:
mode:
authorYuutaW <17158086+Trumeet@users.noreply.github.com>2019-02-28 19:50:55 -0800
committerYuutaW <17158086+Trumeet@users.noreply.github.com>2019-02-28 19:50:55 -0800
commit39de35e09424c573670d4c56742c17a3bdbe8108 (patch)
tree7b339eae41a14d0e54da967b65c2c78e66fcd9f0 /app/src/main/java/moe/yuuta/gplicense/Policy.java
parent1ff7d4d73a0c7d89487f40ccdab7433685e2200b (diff)
downloadWorkMode-39de35e09424c573670d4c56742c17a3bdbe8108.tar
WorkMode-39de35e09424c573670d4c56742c17a3bdbe8108.tar.gz
WorkMode-39de35e09424c573670d4c56742c17a3bdbe8108.tar.bz2
WorkMode-39de35e09424c573670d4c56742c17a3bdbe8108.zip
feat(app): implement Google Play App Licensing
Signed-off-by: YuutaW <17158086+Trumeet@users.noreply.github.com>
Diffstat (limited to 'app/src/main/java/moe/yuuta/gplicense/Policy.java')
-rw-r--r--app/src/main/java/moe/yuuta/gplicense/Policy.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/src/main/java/moe/yuuta/gplicense/Policy.java b/app/src/main/java/moe/yuuta/gplicense/Policy.java
new file mode 100644
index 0000000..c261d82
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/gplicense/Policy.java
@@ -0,0 +1,49 @@
+package moe.yuuta.gplicense;
+
+/**
+ * Policy used by {@link LicenseChecker} to determine whether a user should have
+ * access to the application.
+ */
+public interface Policy {
+
+ /**
+ * Change these values to make it more difficult for tools to automatically
+ * strip LVL protection from your APK.
+ */
+
+ /**
+ * LICENSED means that the server returned back a valid license response
+ */
+ int LICENSED = 0x0100;
+ /**
+ * NOT_LICENSED means that the server returned back a valid license response
+ * that indicated that the user definitively is not licensed
+ */
+ int NOT_LICENSED = 0x0231;
+ /**
+ * RETRY means that the license response was unable to be determined ---
+ * perhaps as a result of faulty networking
+ */
+ int RETRY = 0x0123;
+
+ /**
+ * Provide results from contact with the license server. Retry counts are
+ * incremented if the current value of response is RETRY. Results will be
+ * used for any future policy decisions.
+ *
+ * @param response the result from validating the server response
+ * @param rawData the raw server response data, can be null for RETRY
+ */
+ void processServerResponse(int response, ResponseData rawData);
+
+ /**
+ * Check if the user should be allowed access to the application.
+ */
+ boolean allowAccess();
+
+ /**
+ * Gets the licensing URL returned by the server that can enable access for unlicensed apps (e.g.
+ * buy app on the Play Store).
+ */
+ String getLicensingUrl();
+} \ No newline at end of file