/// <summary> /// Validates the license async. /// </summary> /// <returns>The license async.</returns> /// /// Get the licenseKey of the device -> ANDROID.ID /// /// Validate the licensekey: /// * If Network is available: /// Validate the licensekey through the server -> TRUE -> Run the App /// | /// | FALSE /// V /// Msg(LicenseError) -> Do not run the App /// ______________________________________________________________________________________________________________ /// /// * If no network available: /// Run App /// /// ____________________________________________________________________________________________________________________________________________________________________________________________________________ /// /// async private Task<bool> ValidateLicenseAsync(BusinessLayer.User user) { // get the ANDROID.ID String android_id = Android.Provider.Settings.Secure.GetString(this.ContentResolver, Android.Provider.Settings.Secure.AndroidId); if (user.NetworkStatus != NetworkState.Disconnected) { if (await user.ValidateLicenseAsync(android_id) == false) { // user is not allowed to start app because license has not been validated new AlertDialog.Builder(this) .SetPositiveButton("OK", (sender, args) => { // User pressed yes }) .SetMessage(Resource.String.LicenseError) .SetTitle(Resource.String.LicenseErrorTitle) .Show(); return false; } else { // license validated return true; } } return true; }