private void doCheck() { mCheckLicenseButton.setEnabled(false); setProgressBarIndeterminateVisibility(true); mStatusText.setText(R.string.checking_license); mChecker.checkAccess(mLicenseCheckerCallback); }
public static boolean check(@NonNull AppCompatActivity context, @NonNull LicensingCallback cb) { final String key = Config.get().licensingPublicKey(); if (key == null || key.trim().isEmpty()) { LOG("License checking is disabled."); return true; } else if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_VALID, false)) { LOG("License checking has already been done, and the license check was successful."); return true; } if (BuildConfig.DEBUG) { Toast.makeText(context, "License checking is disabled for this debug build.", Toast.LENGTH_SHORT).show(); return true; } if (context.getContentResolver() == null) { if (!context.isFinishing()) context.finish(); return false; } mProgress = ProgressDialogFragment.show(context, R.string.checking_license); final String deviceId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); // Library calls this when it's done. mLicenseCheckerCallback = new MyLicenseCheckerCallback(context, cb); // Construct the LicenseChecker with a policy. mChecker = new LicenseChecker( context, new ServerManagedPolicy(context, new AESObfuscator(getSalt(context), BuildConfig.APPLICATION_ID, deviceId)), key); mChecker.checkAccess(mLicenseCheckerCallback); return false; }
checker.checkAccess(new LicenseCheckerCallback() {