我已经在我的应用程序中实现了应用程序内购买。但我需要自定义购买的详细信息,购买时间应该是第一个,第二个购买的项目数量是连续的。基本上来自Dungeons示例,它只显示该列
android.test.purchased 1
我需要这样的东西,
2012FEB1 2 $已购买
任何人都可以帮我实现这个目标吗?
答案 0 :(得分:5)
您可以在交易完成后从数据库中检索数据!!希望这是有帮助的
public void getdataFromDB() {
db = openOrCreateDatabase("purchase.db", MODE_WORLD_WRITEABLE, null);
cLocal = db.rawQuery("select * from history ", null);
cLocal.moveToFirst();
for (int z = 0; z < cLocal.getCount(); z++) {
id = cLocal.getString(cLocal.getColumnIndex("_id"));
productId = cLocal.getInt(cLocal.getColumnIndex("productId"));
state = cLocal.getString(cLocal.getColumnIndex("state"));
purchaseTime = cLocal.getString(cLocal
.getColumnIndex("purchaseTime"));
developerPayload = cLocal.getInt(cLocal
.getColumnIndex("developerPayload"));
if (z < (cLocal.getCount() - 1)) {
cLocal.moveToNext();
}
Toast.makeText(getApplicationContext(), state,Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), "Please wait",Toast.LENGTH_LONG).show();
}
//Toast.makeText(getApplicationContext(), "..."+productId+"..."+state+"..."+purchaseTime+"..."+developerPayload,Toast.LENGTH_LONG).show();
}