/// <summary> /// Disconnects BillingClient. Needs to be called in the Activity OnDestroy /// </summary> public Task StopAsync() { try { // Reset the Task Source for Billing Client Connection _connected?.TrySetCanceled(); _connected = null; if (_billingClient != null && _billingClient.IsReady) { _billingClient.EndConnection(); _billingClient.Dispose(); _billingClient = null; } } catch (Exception ex) { Log.Debug(_billingTag, $"Unable to EndConnection: {ex.Message}"); } Log.Debug(_billingTag, "Disconnected"); // Completed Task return(Task.CompletedTask); }
/// <summary> /// Disconnects from BillingClient /// </summary> /// <returns></returns> public bool Disconnect() { if (BillingClient != null) { BillingClient.EndConnection(); BillingClient = null; } return(true); }