anjlab get product name and price from google play

1.1k views Asked by At

I'm using anjlab https://github.com/anjlab/android-inapp-billing-v3 for billing in my app.

I'm new on android studio and I'd like some help with my code.

bp.getPurchaseListingDetails("YOUR PRODUCT ID FROM GOOGLE PLAY CONSOLE HERE");

As a result it will be a SkuDetails object with the following info included:

public final String productId; public final String title; public final String description; public final boolean isSubscription; public final String currency; public final Double priceValue; public final String priceText;

Ok, so I'd like to get, for example, product price, I'm trying:

    String price = bp.getPurchaseListingDetails("productidname").priceText;
    pricevalue.setText(price);

It is returning null. I'm doing something wrong??

1

There are 1 answers

0
Pankaj Mundra On

I know it's been late, but below is my answer which will work for you.

Write below code in

public void onBillingInitialized() {
     SkuDetails sku = bp.getPurchaseListingDetails("YOUR PRODUCT ID FROM GOOGLE PLAY CONSOLE HERE");
     String price =sku.priceText;
}

I am sure your problem will be resolved.