/** * Converts the current {@link VirtualItem} to a JSONObject. * * @return a JSONObject representation of the current {@link VirtualItem}. */ public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try { jsonObject.put(JSONConsts.ITEM_NAME, mName); jsonObject.put(JSONConsts.ITEM_DESCRIPTION, mDescription); jsonObject.put(JSONConsts.ITEM_ITEMID, mItemId); } catch (JSONException e) { StoreUtils.LogError(TAG, "An error occurred while generating JSON object."); } return jsonObject; }
/** * This is the entry point for all asynchronous messages sent from Android Market to the * application. This method forwards the messages on to the {@link BillingService}, which handles * the communication back to Android Market. The {@link BillingService} also reports state changes * back to the application through the {@link ResponseHandler}. */ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) { String signedData = intent.getStringExtra(Consts.INAPP_SIGNED_DATA); String signature = intent.getStringExtra(Consts.INAPP_SIGNATURE); purchaseStateChanged(context, signedData, signature); } else if (Consts.ACTION_NOTIFY.equals(action)) { String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID); StoreUtils.LogDebug(TAG, "notifyId: " + notifyId); notify(context, notifyId); } else if (Consts.ACTION_RESPONSE_CODE.equals(action)) { long requestId = intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1); int responseCodeIndex = intent.getIntExtra( Consts.INAPP_RESPONSE_CODE, Consts.ResponseCode.RESULT_ERROR.ordinal()); checkResponseCode(context, requestId, responseCodeIndex); } else { Log.w(TAG, "unexpected action: " + action); } }
public static void removeNonConsumableItem(String nonConsItemId) throws VirtualItemNotFoundException, ClassCastException { StoreUtils.LogDebug("SOOMLA", "removeNonConsumableItem is called from java!"); StoreInventory.removeNonConsumableItem(nonConsItemId); }
public static boolean nonConsumableItemExists(String nonConsItemId) throws VirtualItemNotFoundException, ClassCastException { StoreUtils.LogDebug("SOOMLA", "nonConsumableItemExists is called from java!"); return StoreInventory.nonConsumableItemExists(nonConsItemId); }
public static void removeUpgrades(String goodItemId) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "removeUpgrades is called from java!"); StoreInventory.removeUpgrades(goodItemId); }
public static void upgradeVirtualGood(String goodItemId) throws VirtualItemNotFoundException, InsufficientFundsException { StoreUtils.LogDebug("SOOMLA", "upgradeVirtualGood is called from java!"); StoreInventory.upgradeVirtualGood(goodItemId); }
public static String getGoodCurrentUpgrade(String goodItemId) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "removeGoodAmount is called from java!"); return StoreInventory.getGoodCurrentUpgrade(goodItemId); }
public static int getGoodUpgradeLevel(String goodItemId) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "getGoodUpgradeLevel is called from java!"); return StoreInventory.getGoodUpgradeLevel(goodItemId); }
public static boolean isVirtualGoodEquipped(String goodItemId) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "isVirtualGoodEquipped is called from java!"); return StoreInventory.isVirtualGoodEquipped(goodItemId); }
public static void unEquipVirtualGood(String goodItemId) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "unEquipVirtualGood is called from java!"); StoreInventory.unEquipVirtualGood(goodItemId); }
public static void takeItem(String itemId, int amount) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "removeCurrencyAmount is called from java!"); StoreInventory.takeVirtualItem(itemId, amount); }
public static int getItemBalance(String itemId) throws VirtualItemNotFoundException { StoreUtils.LogDebug("SOOMLA", "getCurrencyBalance is called from java!"); return StoreInventory.getVirtualItemBalance(itemId); }
public static void buy(String itemId) throws VirtualItemNotFoundException, InsufficientFundsException { StoreUtils.LogDebug("SOOMLA", "buy is called from java!"); StoreInventory.buy(itemId); }