How can the price of an in-app billing item be retrieved before actually displaying the android market frontend for the in-app purchase? Currently it looks like the user onl
If you are not following the google trivia example then you can get price by using this code.
private void getItemsPrice(){
List skuList = new ArrayList<>();
skuList.add("example1");
skuList.add("example2");
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
mBillingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode, List skuDetailsList) {
if (responseCode == BillingClient.BillingResponse.OK
&& skuDetailsList != null) {
for (SkuDetails skuDetails : skuDetailsList) {
String sku = skuDetails.getSku();
String price = skuDetails.getPrice();
Log.d("item price",price);
if ("example1".equals(sku)) {
tvPlan1.setText(price);
}
else if ("example2".equals(sku)){
tvPlan2.setText(price);
}
}
}
}
});
}