安卓:In App Purchase的查询不返回任何产品(skuDetails) [英] Android: In App purchase Query does not return any products(skuDetails)
问题描述
我的工作我的第一个Android应用程序。我真的学到的栈溢出了很多。可是我现在的问题我没有找到一个解决办法呢。
I am working on my first android app. I really learned a lot on stack overflow. But I with my current problem I did not find a solution yet.
我试图实施,在应用程序内购买。我做了以下几件事:
I tried to implement "in app purchase". I did the following things:
1)在开发者控制台我上传的alpha和beta测试一个签名的apk。我还添加了一个测试用户的帐户和测试我使用该帐户。此外,我增加了一些在应用产品(管理)的状态活跃。
1) In the developer console I uploaded a signed apk in alpha and beta test. I also added a test user to the account and for testing I am using that account. Additionally I added some "In app products(managed)" with the status active.
2)描述的一样在 http://developer.android.com /training/in-app-billing/index.html 我下载了必需的lib领域,复制$ C $从实例项目TrivialDrive c和遵循所有这些导致的编码步骤:
2) Like described on http://developer.android.com/training/in-app-billing/index.html I downloaded the necessary lib field, copied code from the example project TrivialDrive and followed all the steps which result to the coding:
// called when the app is started
public void setupConnectionToGooglePlay(final Context context) {
this.context = context;
mHelper = new IabHelper(context, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh no, there was a problem. --> no error message shown to
// the user!
Toast.makeText(context, "No connection to google:" + result, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(context, "connection to google:" + result, Toast.LENGTH_LONG).show();
// If connection is established:
get List of all in App Purchase products
getListOfInAppPurchaseProducts();
}
}
});
}
在执行code我得到的结果的一部分,该连接成功建立。因此,该方法getListOfInAppPurchaseProducts()被调用。
When executing this part of code I get the result, that the connection was established successfully. Hence the method getListOfInAppPurchaseProducts() is called.
private void getListOfInAppPurchaseProducts() {
IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (result.isFailure()) {
// no error message is shown to the user
Toast.makeText(context, "Query not successful", Toast.LENGTH_LONG).show();
} else {
String message = result.getMessage();
boolean isSuccess = result.isSuccess();
// no success message is shown to the user
List<String> skus = inventory.getAllOwnedSkus();
Map<String,SkuDetails> map = inventory.getSKUMap();
int size = map.size();
Toast.makeText(
context,
"Message: " + message + "Query successful. Mapsize:" + size, Toast.LENGTH_LONG).show();
WMGooglePlayConnection.this.inventory = inventory;
}
}
};
ArrayList<String> list = new ArrayList<String>();
list.add("test");
list.add("test2");
mHelper.queryInventoryAsync(true, list, mQueryFinishedListener);
}
不幸的是,返回的清单不包含任何SKU细则(即使查询成功)。我查了以下内容:
Unfortunately the returned inventory does not contain any SKU Details (even the query is successful). I checked the following:
- productIds
- 产品ID的状态(活动)
- base64En codedPublicKey
有关测试我使用了一个真实设备(三星ACE 2)。我直接复制apk文件到设备(而不是从谷歌Play下载)。可这是一个问题?
For testing I used a real device (Samsung ACE 2). I copied the apk file directly to the device (not downloaded from google play). Can this be a problem?
是它在某种程度上可能得到SKU细节也与模拟器?
Is it somehow possible to get the SKU Details also with the emulator?
你有任何想法,我可以检查?
Do you have any idea what I can check?
这将是非常好的,如果有人可以帮助我...
It would be really nice if someone could help me...
推荐答案
我只是碰到了这一点。我们在应用内结算的东西打破了对周围时,谷歌播放服务4.4走了出去。一两个星期后,我想。
I just ran into this as well. Our in app billing stuff broke right around when Google Play Service 4.4 went out. A week or two back I think.
要得到你的应用计费产品展现出来,现在你要发布的Alpha构建但他们只看到人们对你的测试列表/组。
To get your in app billing products to show up now you'll have to publish your Alpha builds but have them only visible to people on your tester list/group.
经过一年出版应用程序,然后测试人员可以从谷歌下载它类似于此的链接Play商店。
After one publishes the app then testers can download it from the Google Play Store with a link similar to this.
https://play.google.com/apps/testing/
我希望这有助于。
这篇关于安卓:In App Purchase的查询不返回任何产品(skuDetails)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!