- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果购买了我要开启 Activity ,否则我要开启 Activity 进行购买。我进入 IabHelper 类来执行此操作,但没有得到任何结果。
我哪里错了?
代码 fragment :
private void Controlla_record_per_acquisto(){
SQLiteDatabase db = new DatabaseHelper(getActivity()).getReadableDatabase();
String controllo = "SELECT COUNT(_id) FROM table";
Cursor c = db.rawQuery(controllo, null);
while (c.moveToNext()){
int numero_id = c.getInt(0);
if(numero_id >=1){
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result,
Purchase purchase)
{
if (result.isFailure()) {
// Handle error
return;
}
else if (purchase.getSku().equals(ITEM_SKU)) {
Intent intent = null;
intent = new Intent(getActivity(), Ce.class);
startActivity(intent);
}
}
};
}else {
Intent intent = null;
intent = new Intent(getActivity(), InAppBillingActivity.class);
startActivity(intent);
}
c.close();
db.close();
}
}
最佳答案
尝试使用此代码获取有关您的库存的数据。
不错的文章:
http://developer.android.com/training/in-app-billing/purchase-iab-products.html
调用方法:
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.enableDebugLogging(true);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
return;
}
if (mHelper == null) return;
List<String> st = new ArrayList<String>();
st.add(ITEM_SKU);
mHelper.queryInventoryAsync(true,st,mGotInventoryListener);
}
});
如何查询元素的库存。
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (mHelper == null) return;
if (result.isFailure()) {
return;
}
if(inventory.hasPurchase(ITEM_SKU)) {
Intent intent = null;
intent = new Intent(getActivity(), Ce.class);
startActivity(intent);
}
}
};
关于java - Android IabHelper 检查是否购买,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25251781/
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 6年前关闭。 Improve t
我们有一个专有的销售系统,我们已经使用了一段时间了。最近我们添加了“购买”方面,以便我们可以比较匹配产品的平均购买/销售价格以及查看库存状况。 在 MySQL 中,我有 2 个表:tblPurchas
在查看 Paypal 文档以寻找针对这种情况的解决方案后,我一头雾水。我想要的是一种让购物车订阅(定期付款)和购买商品的方法。有没有一种方法可以解决这个问题,或者我是否必须做一些自定义的事情(如果我使
我想知道是否可以使用youtube api获取可购买或可租借的电影列表。当我转到youtube网站并登录到Google帐户时,我可以看到要购买的电影及其价格。 我想在我的应用程序(http://www
我使用 JavaScript 购买 SDK 和 Node.js。 const fetch = require('node-fetch'); const shopify = require('shopi
我购买了三个不同期限的不同订阅。我已经配置了测试账户,我可以进行测试购买。对于这些购买,谷歌不向我收费,但它们看起来非常像真实的。购买成功后,应用内结算会向我发送一些有关我的购买的数据,例如 pack
我目前正在实现应用内购买,并且刚刚阅读了一些帖子,说需要恢复购买按钮,否则苹果将拒绝应用。 我不想在我的 UI 设计中添加第二个按钮。 所以我的问题是... 有没有办法检查用户之前是否进行过应用内购买
我的应用中有多个项目。我有两个设备。如果我在这些设备中的第一个上购买商品,然后尝试在另一个设备上购买相同的商品,我不能。(Google play intent 显示消息 - 商品已拥有!然后它崩溃了.
有没有办法检测何时通过应用商店为您的应用进行了购买? 检测应用内购买似乎很容易(即我们的服务器可以收到通知),但是对于直接购买有没有办法做到这一点? 如果没有,是否有一些用户的唯一标识符(例如购买时通
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我计划在用户使用该应用程序成功扫描二维码时为应用内购买提供折扣。我知道无法为现有商品提供折扣。我打算以折扣价添加另一件商品。有没有人以前有过使用这种方法的经验? 提前致谢 最佳答案 没有办法直接这样做
我很好奇其他商店在基础应用程序框架方面做了什么?我将应用程序框架视为能够提供额外或扩展的功能以提高基于它构建的应用程序的质量。 有各种开箱即用的框架,例如 Spring(或 Spring.NET)等。
我们正在开发一款使用非续订订阅 IAP 模型的应用。在沙盒中测试订阅购买流程时,我们看到弹出两 strip 有“购买”按钮的消息。 显示第一条消息和产品信息:“您想以 xx.xx 美元购买一个订阅吗?
我的老板购买了 Microsoft 365,它包含三种产品。他现在要求我设计一个管理系统,比如员工自助服务门户。我特此寻求有关从哪里开始或使用哪种产品的建议,因为我对此很陌生。 我尝试了一些研究,发现
我的老板购买了 Microsoft 365,它包含三种产品。他现在要求我设计一个管理系统,比如员工自助服务门户。我特此寻求有关从哪里开始或使用哪种产品的建议,因为我对此很陌生。 我尝试了一些研究,发现
我刚刚了解了IAP Cracker的存在,并试图找出在我的应用中验证IAP购买的最佳方法。 我无法确定的是IAP Cracker是否可以处理“消耗性”商品。如果没有,我没有什么可担心的。 这是维护/验
我正在编写一个允许应用内购买的简单应用。我已经使用 SKU 代码 android.test.purchased 进行了测试,一切正常。 我进入我的 google play 控制台,创建了一个应用程序,
我即将启动一个应用程序,该应用程序将包含多个“应用程序内购买”。 我想做的是有一种方法可以提供少量免费的“应用内购买”来选择评论家等人。 在 apple 框架内有没有办法做到这一点,如果没有,我可以采
所以我在这个网站上工作,用户可以在该网站上发布他们的商品,其他用户可以将一些商品添加到他们的购物车并在线购买。 我考虑的流程是这样的: 商家发布商品及其信用卡/ Paypal 信息。 买家将(来自不同
我对这个主题进行了广泛的研究,但我的知识仍然很模糊。我正在寻找一个简单站点的基本 DV,但我看到每个在线 SSL 都具有三个级别, Root->Intermidiate (充当 Root 的代理)和我
我是一名优秀的程序员,十分优秀!