use of com.soomla.store.events.UnexpectedStoreErrorEvent in project android-store by soomla.
the class StoreInfo method setStoreAssets.
/**
* Another option to set the data of StoreInfo. This will usually be used from game engine
* wrappers like Unity or Cocos2dx.
*
* @param version the version of IStoreAssets.
* @param storeMetaJSON the store metadata as JSON.
*/
public static void setStoreAssets(int version, String storeMetaJSON) {
SoomlaUtils.LogDebug(TAG, "trying to set json: " + storeMetaJSON);
if (TextUtils.isEmpty(storeMetaJSON)) {
SoomlaUtils.LogError(TAG, "The given store assets JSON can't be empty or null!");
return;
}
mCurrentAssetsVersion = version;
// loaded - in that case we initialize with setStoreAssets.
if (!loadFromDB()) {
SoomlaUtils.LogDebug(TAG, "didn't find anything in DB to load. continuing with store assets json.");
try {
fromJSONObject(new JSONObject(storeMetaJSON));
save();
} catch (JSONException e) {
SoomlaUtils.LogError(TAG, "Can't parse store metadata json. That's a major issue." + storeMetaJSON);
BusProvider.getInstance().post(new UnexpectedStoreErrorEvent(UnexpectedStoreErrorEvent.ErrorCode.GENERAL));
}
}
}
Aggregations