/// <summary> /// Initializes a new instance of the <see cref="ResultListener"/> class. /// </summary> /// <param name="validator"> /// The validator. /// </param> /// <param name="checker"> /// The checker. /// </param> public ResultListener(LicenseValidator validator, LicenseChecker checker) { this.checker = checker; this.licenseValidator = validator; this.onTimeout = delegate { Debug.WriteLine("License check timed out."); this.checker.HandleServiceConnectionError(this.licenseValidator); this.checker.FinishCheck(this.licenseValidator); }; this.StartTimeout(); }
private void CheckLicense() { string deviceId = Settings.Secure.GetString(ContentResolver, Settings.Secure.AndroidId); // Construct the LicenseChecker with a policy. var obfuscator = new AesObfuscator(Salt, PackageName, deviceId); var policy = new ServerManagedPolicy(this, obfuscator); _licenseChecker = new LicenseChecker(this, policy, Xamarin.InAppBilling.Utilities.Security.Unify(new[] { GetNumberString (3), GetNumberString (6), GetNumberString (1), GetNumberString (4), GetNumberString (2), GetNumberString (7), GetNumberString (0), GetNumberString (5) }, new[] { 0, 1, 2, 3, 4, 5, 6, 7 })); _licenseChecker.CheckAccess(this); }
/// <summary> /// The run. /// </summary> public void Run() { this.context.IsServiceRunning = true; this.context.downloadNotification.OnDownloadStateChanged(DownloaderState.FetchingUrl); string deviceId = Settings.Secure.GetString(this.context.ContentResolver, Settings.Secure.AndroidId); var aep = new ApkExpansionPolicy( this.context, new AesObfuscator(this.context.Salt, this.context.PackageName, deviceId)); // reset our policy back to the start of the world to force a re-check aep.ResetPolicy(); // let's try and get the OBB file from LVL first // Construct the LicenseChecker with a IPolicy. var checker = new LicenseChecker(this.context, aep, this.context.PublicKey); checker.CheckAccess(new ApkLicenseCheckerCallback(this, aep)); }