Android Open Source - LicenseModuleChecker-Client-Android H K M Checker Plugable






From Project

Back to project page LicenseModuleChecker-Client-Android.

License

The source code is released under:

<?xml version="1.0" encoding="UTF-8"?> <module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4"> <comp...

If you think the Android project LicenseModuleChecker-Client-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.asynhkm.productchecker.Checker;
// www.  j ava  2 s.co m
import android.content.Context;
import android.content.SharedPreferences;

import com.asynhkm.productchecker.Util.Tool;

/**
 * Created by Hesk on 30/12/2014.
 */
public class HKMCheckerPlugable {

    private Context ctx;
    private SharedPreferences SP;
    private String
            licenseKey = "",
            productKey = "",
            mac_id = "";

    public HKMCheckerPlugable(String productkey, Context ctx) {
        SP = ctx.getApplicationContext().getSharedPreferences(param.DATAGROUP, Context.MODE_PRIVATE);
        mac_id = Tool.get_mac_address(ctx);
        licenseKey = SP.getString(param.SAVE_ACH, "");
        this.productKey = productkey;
        this.ctx = ctx;
    }

    /**
     * the net is just started now
     */
    public void netStartCheck(CheckerCB callback) {
        final CheckerTask re = new CheckerTask(this.ctx, callback, SP);
        re.setMac(mac_id);
        if (licenseKey.isEmpty()) {
            re.setStatusRequest(param.request_status.registration);
            //check with the license from the customer
            re.setProductKey(productKey)
                    .setRequestUrl(param.devReg());
        } else {
            re.setStatusRequest(param.request_status.check);
            //check and issue a new license or register
            re.setLicenseKey(licenseKey)
                    .setRequestUrl(param.devCheck());
        }
        re.execute();
    }

    /**
     * public initialization
     *
     * @param productKey
     * @param ctx
     * @return
     */
    public static HKMCheckerPlugable init(String productKey, Context ctx) {
        if (productKey.equalsIgnoreCase("")) Tool.trace(ctx, "has to have the product key entered");
        HKMCheckerPlugable instance = new HKMCheckerPlugable(productKey, ctx);
        return instance;
    }

    /**
     * chain method
     *
     * @param license_token_key
     * @return
     */
    public HKMCheckerPlugable licensed(String license_token_key) {
        licenseKey = license_token_key;
        return this;
    }

}




Java Source Code List

com.asynhkm.example.ApplicationTest.java
com.asynhkm.example.MainExample.java
com.asynhkm.productchecker.ApplicationTest.java
com.asynhkm.productchecker.PreferenceControl.java
com.asynhkm.productchecker.Checker.CheckerCB.java
com.asynhkm.productchecker.Checker.CheckerTask.java
com.asynhkm.productchecker.Checker.HKMCheckerPlugable.java
com.asynhkm.productchecker.Checker.param.java
com.asynhkm.productchecker.Util.JSONReader.java
com.asynhkm.productchecker.Util.RootDialog.java
com.asynhkm.productchecker.Util.Tool.java
com.asynhkm.productchecker.schema.DataProductVersion.java
com.asynhkm.productchecker.schema.RDataDeserialize.java
com.asynhkm.productchecker.schema.RRDeserialize.java
com.asynhkm.productchecker.schema.ReturnData.java
com.asynhkm.productchecker.schema.ReturnResult.java
com.asynhkm.productchecker.schema.requestCheck.java