Android Question Billing3 Lib - PurchaseCompleted event not raised

Discussion in 'Android Questions' started by DevBaby, Mar 19, 2015.

  1. DevBaby

    DevBaby Active Member Licensed User


    I can successfully make a purchase, but the purchases completed event is not raised.

    The billing manager code is a services, I call the "InAppBillingService.Manager.RequestPayment" from my main activity, where I can make a payment on my test account through google.

    However, the following event is not raised...

    Public Sub manager_PurchaseCompleted (Success As Boolean, Product As Purchase)
    If Success  = True Then
    Log("You purchased " & Product.ProductId)
    End If
    End Sub
    The product is purchased because I have a check to consume any owned products when the app starts in case of a connection fail during a purchase. When I start the app, the product is consumed and distributed within the app....but this should happen immediately in the PurchaseComplete event.

    Update...this event is only raised if I place the code in the main activity. How can i force it to raise if the code is in the service module?
    Last edited: Mar 19, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    You cannot show a UI from a service. You must call RequestPayment from the activity and handle the event in the activity.
  3. DevBaby

    DevBaby Active Member Licensed User

    Thanks Erel,

    There are some calls that I can't make from the Activity, such as

    I get a null pointer error, should I precede the call with something?
  4. Erel

    Erel Administrator Staff Member Licensed User

    I recommend you to only use this object from an activity.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice