Can't get in-app purchase from the Store in release version
sebaber opened this issue · 2 comments
I can not get the in-app purchase items from the Store in release version. I try in testflight and there i can get it.
Have an idea what is the problem that i having?
Version of gdx-pay and/or relevant dependencies
compile "com.badlogicgames.gdxpay:gdx-pay-iosrobovm-apple:1.0.0"
Code of my class that use PurchaseManageriOSApple
public class AppStoreGateway extends BaseBrokerGateway {
private static final String TAG = "Billing";
private final PurchaseManager purchaseManager;
private Map<String, Integer> skus;
private static AppStoreGateway instance;
public static AppStoreGateway getInstance(PurchaseManager purchaseManager){
if(instance == null)
instance = new AppStoreGateway(purchaseManager);
return instance;
}
private AppStoreGateway(PurchaseManager purchaseManager){
super();
this.purchaseManager = purchaseManager;
this.skus = new HashMap<String, Integer>();
skus.put("a", 1);
skus.put("b", 2);
skus.put("c", 3);
skus.put("d", 4);
this.initPurchaseManager();
}
private void initPurchaseManager() {
PurchaseManagerConfig pmc = new PurchaseManagerConfig();
for (String id: skus.keySet()) {
pmc.addOffer(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(id));
}
purchaseManager.install(new MyPurchaseObserver(), pmc, true);
}
@Override
public void configure() {
List<MyInformation> details = new ArrayList<>();
for (String id: skus.keySet()) {
details.add(new MyInformation(purchaseManager.getInformation(id), id));
}
createOffers(details);
}
private Double getPrinceInDouble(String priceString){
String numberString = priceString.replace(",",".");
return Double.parseDouble(numberString);
}
private void createOffers(List<MyInformation> details){
this.offers.clear();
MyOffer offer;
for(MyInformation detail : details){
offer = new MyOffer();
offer.setCode(detail.productId);
offer.setPrice(getPrinceInDouble(detail.info.getLocalPricing().split("\\s+")[1]));
offer.setCurrency(detail.info.getPriceCurrencyCode());
offer.setDescription(detail.info.getLocalDescription());
offer.setCount(this.skus.get(detail.productId));
offers.add(offer);
}
}
//....
}
// This class create the AppStoreGateway
public class IOSPurchaseBilling extends ControllerBillingBase {
private AppStoreGateway appStoreGateway;
public PurchaseManager purchaseManager;
public IOSPurchaseBilling() {
this.purchaseManager = new PurchaseManageriOSApple();
}
public void start() {
appStoreGateway = AppStoreGateway.getInstance(purchaseManager);
}
public IBrokerGateway get() {
if(appStoreGateway != null)
return appStoreGateway;
return null;
}
}
Something that i miss?
I put examples for the in-app purchase identifier
- [ X] apple robovm
nevermind, there was a bug in my code:
private void createOffers(List<MyInformation> details){ this.offers.clear(); MyOffer offer; for(MyInformation detail : details){ offer = new MyOffer(); offer.setCode(detail.productId); offer.setPrice(getPrinceInDouble(detail.info.getLocalPricing().split("\\s+")[1])); offer.setCurrency(detail.info.getPriceCurrencyCode()); offer.setDescription(detail.info.getLocalDescription()); offer.setCount(this.skus.get(detail.productId)); offers.add(offer); } }
When i set the price, if the region change, it crash. Don´t happen in my enviroment because its always the same currency in price, but when tester of iOS App Store try it crash.
Sorry for that!