示例#1
0
        /// <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);
        }