//--------------------------------------
    // Event Handlers
    //--------------------------------------


    private void OnProductPurchased(BillingResult result)
    {
        UM_InAppProduct p = UltimateMobileSettings.Instance.GetProductByAndroidId(result.Purchase.SKU);

        if (p != null)
        {
            if (p.IsConsumable && result.IsSuccess)
            {
                AndroidInAppPurchaseManager.Client.Consume(result.Purchase.SKU);
            }
            else
            {
                UM_PurchaseResult r = new UM_PurchaseResult();
                r.isSuccess = result.IsSuccess;
                r.product   = p;
                r.SetResponceCode(result.Response);
                r.Google_PurchaseInfo = result.Purchase;

                SendPurchaseFinishedEvent(r);
            }
        }
        else
        {
            SendNoTemplateEvent();
        }
    }
Example #2
0
    private void Android_OnProductConsumed(BillingResult result)
    {
        UM_InAppProduct p = UltimateMobileSettings.Instance.GetProductByAndroidId(result.purchase.SKU);

        if (p != null)
        {
            UM_PurchaseResult r = new UM_PurchaseResult();
            r.isSuccess = result.isSuccess;
            r.product   = p;
            r.SetResponceCode(result.response);
            r.Google_PurchaseInfo = result.purchase;
            SendPurchaseEvent(r);
        }
        else
        {
            SendNoTemplateEvent();
        }
    }