当前位置: 首页>>代码示例>>Java>>正文


Java SoomlaUtils.LogError方法代码示例

本文整理汇总了Java中com.soomla.SoomlaUtils.LogError方法的典型用法代码示例。如果您正苦于以下问题:Java SoomlaUtils.LogError方法的具体用法?Java SoomlaUtils.LogError怎么用?Java SoomlaUtils.LogError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.soomla.SoomlaUtils的用法示例。


在下文中一共展示了SoomlaUtils.LogError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRestorePurchasessFinished

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
@Override
public void onRestorePurchasessFinished(IabResult result, IabInventory inventory) {
    SoomlaUtils.LogDebug(TAG, "Restore Purchases succeeded");
    if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_OK && mRestorePurchasesListener != null) {
        // fetching owned items
        List<String> itemSkus = inventory.getAllOwnedSkus(IabHelper.ITEM_TYPE_INAPP);
        List<IabPurchase> purchases = new ArrayList<IabPurchase>();
        for (String sku : itemSkus) {
            IabPurchase purchase = inventory.getPurchase(sku);
            purchases.add(purchase);
        }

        this.mRestorePurchasesListener.success(purchases);
    } else {
        SoomlaUtils.LogError(TAG, "Wither mRestorePurchasesListener==null OR Restore purchases error: " + result.getMessage());
        if (this.mRestorePurchasesListener != null) this.mRestorePurchasesListener.fail(result.getMessage());
    }

    stopIabHelper(null);
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:21,代码来源:TapClashIabService.java

示例2: onFetchSkusDetailsFinished

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
@Override
public void onFetchSkusDetailsFinished(IabResult result, IabInventory inventory) {
    SoomlaUtils.LogDebug(TAG, "Restore Purchases succeeded");
    if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_OK && mFetchSkusDetailsListener != null) {

        // @lassic (May 1st): actually, here (query finished) it only makes sense to get the details
        // of the SKUs we already queried for
        List<String> skuList = inventory.getAllQueriedSkus(false);
        List<IabSkuDetails> skuDetails = new ArrayList<IabSkuDetails>();
        for (String sku : skuList) {
            IabSkuDetails skuDetail = inventory.getSkuDetails(sku);
            if (skuDetail != null) {
                skuDetails.add(skuDetail);
            }
        }

        this.mFetchSkusDetailsListener.success(skuDetails);
    } else {
        SoomlaUtils.LogError(TAG, "Wither mFetchSkusDetailsListener==null OR Fetching details error: " + result.getMessage());
        if (this.mFetchSkusDetailsListener != null) this.mFetchSkusDetailsListener.fail(result.getMessage());
    }

    stopIabHelper(null);
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:25,代码来源:TapClashIabService.java

示例3: onDestroy

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
@Override
        protected void onDestroy() {
            SoomlaUtils.LogDebug(TAG, "onDestroy 1");
            if (!mInProgressDestroy && TapClashIabService.getInstance().mWaitingServiceResponse)
            {
                SoomlaUtils.LogDebug(TAG, "onDestroy 2");
                TapClashIabService.getInstance().mWaitingServiceResponse = false;
                String err = "IabActivity is destroyed during purchase.";
                SoomlaUtils.LogError(TAG, err);

                // we're letting the helper take care of closing so there won't be any async process stuck in it.
                onActivityResult(10001, Activity.RESULT_CANCELED, null);

//                if (TapClashIabService.getInstance().mSavedOnPurchaseListener != null) {
//                    SoomlaUtils.LogDebug(TAG, "onDestroy 3");
//                    TapClashIabService.getInstance().mSavedOnPurchaseListener.fail(err);
//                    TapClashIabService.getInstance().mSavedOnPurchaseListener = null;
//                }
            }
            SoomlaUtils.LogDebug(TAG, "onDestroy 4");
            super.onDestroy();
        }
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:23,代码来源:TapClashIabService.java

示例4: toJSONObject

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Converts the current <code>RandomReward</code> to a JSONObject.
 *
 * @return A <code>JSONObject</code> representation of the current <code>RandomReward</code>.
 */
@Override
public JSONObject toJSONObject(){
    JSONObject jsonObject = super.toJSONObject();
    try {
        JSONArray rewardsArr = new JSONArray();
        for (Reward reward : mRewards) {
            rewardsArr.put(reward.toJSONObject());
        }
        jsonObject.put(com.soomla.data.JSONConsts.SOOM_REWARDS, rewardsArr);
    } catch (JSONException e) {
        SoomlaUtils.LogError(TAG, "An error occurred while generating JSON object.");
    }

    return jsonObject;
}
 
开发者ID:soomla,项目名称:soomla-android-core,代码行数:21,代码来源:RandomReward.java

示例5: getLevelUpModel

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
public static JSONObject getLevelUpModel() {
    JSONObject modelJSON = null;

    String model = KeyValueStorage.getValue(DB_KEY_PREFIX + "model");
    SoomlaUtils.LogDebug(TAG, "model: " + model);
    if (model == null) {
        return null;
    }

    try {
        modelJSON = new JSONObject(model);
    } catch (JSONException e) {
        SoomlaUtils.LogError(TAG, "Unable to parse LevelUp model into JSON");
    }

    return modelJSON;
}
 
开发者ID:soomla,项目名称:android-levelup,代码行数:18,代码来源:LevelUp.java

示例6: getCurrencyCode

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Gets currency code from market place code
 * For example, if marketPlace "US" return "USD"
 *
 * @param marketPlace The market place code.
 * @return Currency code corresponding to marketPlace.
 * If maketPlace is null, empty or not supported, return "NO_CODE"
 *
 */
public static String getCurrencyCode(String marketPlace){
    if (marketPlace == null || marketPlace.isEmpty()){
        SoomlaUtils.LogDebug(TAG, "(getCurrencyCode) Market place string is null or empty.");
        return DEFAULT_CURRENCY_CODE;
    }

    try{
        Locale locale = new Locale("", marketPlace);
        return Currency.getInstance(locale).getCurrencyCode();
    }catch (IllegalArgumentException ex){
        SoomlaUtils.LogError(TAG, "locale's country: " + marketPlace + " is not a supported ISO 3166 country. ");
    }

    return DEFAULT_CURRENCY_CODE;
}
 
开发者ID:soomla,项目名称:android-store-amazon,代码行数:25,代码来源:AmazonIabUtils.java

示例7: onDestroy

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
@Override
protected void onDestroy() {

    if (NokiaStoreIabService.getInstance().mWaitingServiceResponse)
    {
        NokiaStoreIabService.getInstance().mWaitingServiceResponse = false;
        String err = "IabActivity is destroyed during purchase.";
        SoomlaUtils.LogError(TAG, err);
        if (NokiaStoreIabService.getInstance().mSavedOnPurchaseListener != null) {
            NokiaStoreIabService.getInstance().mSavedOnPurchaseListener.fail(err);
            NokiaStoreIabService.getInstance().mSavedOnPurchaseListener = null;
        }
    }

    super.onDestroy();
}
 
开发者ID:Marneus68,项目名称:android-store-nokia-store,代码行数:17,代码来源:NokiaStoreIabService.java

示例8: setPublicKey

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Sets the public key for Google Play IAB Service.
 * This function MUST be called once when the application loads and after SoomlaStore
 * initializes.
 *
 * @param publicKey the public key from the developer console.
 */
public void setPublicKey(String publicKey) {
    SharedPreferences prefs = SoomlaApp.getAppContext().
            getSharedPreferences(SoomlaConfig.PREFS_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor edit = prefs.edit();

    if (publicKey != null && publicKey.length() != 0) {
        edit.putString(PUBLICKEY_KEY, publicKey);
    } else if (prefs.getString(PUBLICKEY_KEY, "").length() == 0) {
        String err = "publicKey is null or empty. Can't initialize store!!";
        SoomlaUtils.LogError(TAG, err);
    }
    edit.commit();
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:21,代码来源:TapClashIabService.java

示例9: launchPurchaseFlow

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * see parent
 */
@Override
public void launchPurchaseFlow(String sku,
                               final IabCallbacks.OnPurchaseListener purchaseListener,
                               String extraData) {

    SharedPreferences prefs = SoomlaApp.getAppContext().
            getSharedPreferences(SoomlaConfig.PREFS_NAME, Context.MODE_PRIVATE);
    String publicKey = prefs.getString(PUBLICKEY_KEY, "");
    if (publicKey.length() == 0 || publicKey.equals("[YOUR PUBLIC KEY FROM THE MARKET]")) {
        SoomlaUtils.LogError(TAG, "You didn't provide a public key! You can't make purchases. the key: " + publicKey);
        throw new IllegalStateException();
    }


    try {
        final Intent intent = new Intent(SoomlaApp.getAppContext(), IabActivity.class);
        intent.putExtra(SKU, sku);
        intent.putExtra(EXTRA_DATA, extraData);

        mSavedOnPurchaseListener = purchaseListener;
        if (SoomlaApp.getAppContext() instanceof Activity) {
            Activity activity = (Activity) SoomlaApp.getAppContext();
            activity.startActivity(intent);
        } else {
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            SoomlaApp.getAppContext().startActivity(intent);
        }

    } catch(Exception e){
        String msg = "(launchPurchaseFlow) Error purchasing item " + e.getMessage();
        SoomlaUtils.LogError(TAG, msg);
        purchaseListener.fail(msg);
    }

}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:39,代码来源:TapClashIabService.java

示例10: consume

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Consumes a given in-app product. Consuming can only be done on an item
 * that's owned, and as a result of consumption, the user will no longer own it.
 * This method may block or take long to return. Do not call from the UI thread.
 * For that, see {@link #consumeAsync}.
 *
 * @param itemInfo The PurchaseInfo that represents the item to consume.
 * @throws IabException if there is a problem during consumption.
 */
 public void consume(IabPurchase itemInfo) throws IabException {
     checkSetupDoneAndThrow("consume");

    if (!itemInfo.getItemType().equals(ITEM_TYPE_INAPP)) {
        throw new IabException(IabResult.IABHELPER_INVALID_CONSUMPTION,
                "Items of type '" + itemInfo.getItemType() + "' can't be consumed.");
    }

    try {
        String token = itemInfo.getToken();
        String sku = itemInfo.getSku();
        if (token == null || token.equals("")) {
           SoomlaUtils.LogError(TAG, "Can't consume "+ sku + ". No token.");
           throw new IabException(IabResult.IABHELPER_MISSING_TOKEN, "PurchaseInfo is missing token for sku: "
               + sku + " " + itemInfo);
        }

        SoomlaUtils.LogDebug(TAG, "Consuming sku: " + sku + ", token: " + token);
        int response = mService.consumePurchase(3, SoomlaApp.getAppContext().getPackageName(), token);
        if (response == IabResult.BILLING_RESPONSE_RESULT_OK) {
           SoomlaUtils.LogDebug(TAG, "Successfully consumed sku: " + sku);
        }
        else {
           SoomlaUtils.LogDebug(TAG, "Error consuming consuming sku " + sku + ". " + IabResult.getResponseDesc(response));
           throw new IabException(response, "Error consuming sku " + sku);
        }
    }
    catch (RemoteException e) {
        throw new IabException(IabResult.IABHELPER_REMOTE_EXCEPTION, "Remote exception while consuming. PurchaseInfo: " + itemInfo, e);
    }
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:41,代码来源:TapClashIabHelper.java

示例11: querySkuDetailsChunk

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Queries a chunk of SKU details to prevent Google's 20 items bug.
 *
 * @throws RemoteException
 * @throws JSONException
 */
private int querySkuDetailsChunk(String itemType, IabInventory inv, ArrayList<String> chunkSkuList) throws RemoteException, JSONException {
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, chunkSkuList);
    Bundle skuDetails = mService.getSkuDetails(3, SoomlaApp.getAppContext().getPackageName(),
            itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
            SoomlaUtils.LogDebug(TAG, "querySkuDetailsChunk() failed: " + IabResult.getResponseDesc(response));
            return response;
        }
        else {
            SoomlaUtils.LogError(TAG, "querySkuDetailsChunk() returned a bundle with neither an error nor a detail list.");
            return IabResult.IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(
            RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        IabSkuDetails d = new IabSkuDetails(itemType, thisResponse);
        SoomlaUtils.LogDebug(TAG, "Got sku details: " + d);
        inv.addSkuDetails(d);
    }

    return IabResult.BILLING_RESPONSE_RESULT_OK;
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:36,代码来源:TapClashIabHelper.java

示例12: getResponseCodeFromBundle

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Workaround to bug where sometimes response codes come as Long instead of Integer
 */
private int getResponseCodeFromBundle(Bundle b) {
    Object o = b.get(RESPONSE_CODE);
    if (o == null) {
        SoomlaUtils.LogDebug(TAG, "Bundle with null response code, assuming OK (known issue)");
        return IabResult.BILLING_RESPONSE_RESULT_OK;
    }
    else if (o instanceof Integer) return ((Integer)o).intValue();
    else if (o instanceof Long) return (int)((Long)o).longValue();
    else {
        SoomlaUtils.LogError(TAG, "Unexpected type for bundle response code.");
        SoomlaUtils.LogError(TAG, o.getClass().getName());
        throw new RuntimeException("Unexpected type for bundle response code: " + o.getClass().getName());
    }
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:18,代码来源:TapClashIabHelper.java

示例13: getResponseCodeFromIntent

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
 * Workaround to bug where sometimes response codes come as Long instead of Integer
 */
private int getResponseCodeFromIntent(Intent i) {
    Object o = i.getExtras().get(RESPONSE_CODE);
    if (o == null) {
        SoomlaUtils.LogError(TAG, "Intent with no response code, assuming OK (known issue)");
        return IabResult.BILLING_RESPONSE_RESULT_OK;
    }
    else if (o instanceof Integer) return ((Integer)o).intValue();
    else if (o instanceof Long) return (int)((Long)o).longValue();
    else {
        SoomlaUtils.LogError(TAG, "Unexpected type for intent response code.");
        SoomlaUtils.LogError(TAG, o.getClass().getName());
        throw new RuntimeException("Unexpected type for intent response code: " + o.getClass().getName());
    }
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:18,代码来源:TapClashIabHelper.java

示例14: refreshToken

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
private boolean refreshToken() throws IOException, JSONException {
    this.accessToken = null;
    HttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost(GOOGLE_AUTH_URL);

    List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
    urlParameters.add(new BasicNameValuePair("grant_type", "refresh_token"));
    urlParameters.add(new BasicNameValuePair("client_id", clientId));
    urlParameters.add(new BasicNameValuePair("client_secret", clientSecret));
    urlParameters.add(new BasicNameValuePair("refresh_token", refreshToken));

    post.setEntity(new UrlEncodedFormEntity(urlParameters));

    HttpResponse resp = client.execute(post);

    if (resp == null) {
        SoomlaUtils.LogError(TAG, "Failed to connect to google server.");
        return false;
    }

    StringBuilder stringBuilder = new StringBuilder();
    InputStream inputStream = resp.getEntity().getContent();
    Reader reader = new BufferedReader(new InputStreamReader(inputStream));
    final char[] buffer = new char[1024];
    int bytesRead;
    while ((bytesRead = reader.read(buffer, 0, buffer.length)) > 0) {
        stringBuilder.append(buffer, 0, bytesRead);
    }
    JSONObject resultJsonObject = new JSONObject(stringBuilder.toString());

    int statusCode = resp.getStatusLine().getStatusCode();
    if (statusCode < 200 || statusCode > 299) {
        SoomlaUtils.LogError(TAG, "There was a problem refreshing the token. Will try again later.");
        return false;
    }

    this.accessToken = resultJsonObject.optString("access_token");

    return !TextUtils.isEmpty(this.accessToken);
}
 
开发者ID:soomla,项目名称:android-store-google-play,代码行数:41,代码来源:SoomlaGpVerification.java

示例15: SoomlaGpVerification

import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
public SoomlaGpVerification(IabPurchase purchase, String clientId, String clientSecret, String refreshToken, boolean verifyOnServerFailure) {
    if (purchase == null || TextUtils.isEmpty(clientId) || TextUtils.isEmpty(clientSecret) || TextUtils.isEmpty(refreshToken)) {
        SoomlaUtils.LogError(TAG, "Can't initialize SoomlaGpVerification. Missing params.");
        throw new IllegalArgumentException();
    }

    this.clientId = clientId;
    this.clientSecret = clientSecret;
    this.refreshToken = refreshToken;
    this.verifyOnServerFailure = verifyOnServerFailure;

    this.purchase = purchase;
}
 
开发者ID:soomla,项目名称:android-store-google-play,代码行数:14,代码来源:SoomlaGpVerification.java


注:本文中的com.soomla.SoomlaUtils.LogError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。