标签: android-billing

关于尾随字符的Android结算例外

我从崩溃报告中得到了这个例外:

java.lang.RuntimeException: Unable to start service com.problemio.BillingService@4132b868 with Intent { act=com.android.vending.billing.PURCHASE_STATE_CHANGED cmp=com.problemio/.BillingService (has extras) }: java.lang.IllegalArgumentException: utils.Base64DecoderException: single trailing character at offset 19
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2376)
at android.app.ActivityThread.access$1900(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: utils.Base64DecoderException: single trailing character at offset 19
at utils.Security.generatePublicKey(Security.java:199)
at utils.Security.verifyPurchase(Security.java:118)
at com.problemio.BillingService.purchaseStateChanged(BillingService.java:545)
at com.problemio.BillingService.handleCommand(BillingService.java:421)
at com.problemio.BillingService.onStart(BillingService.java:398)
at android.app.Service.onStartCommand(Service.java:438)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
... 10 more
Caused by: utils.Base64DecoderException: single trailing character …
Run Code Online (Sandbox Code Playgroud)

android exception android-billing

8
推荐指数
1
解决办法
2294
查看次数

Android计费 - 在文件Security.java中,base64EncodedPublicKey应该是编码值吗?

我应该将我的应用程序的实际公钥正确粘贴到此变量的值中吗?

或者我应该编码它然后编码的字符串是什么,我将该字符串变成这个变量的值?

应该是哪个?

android android-billing

8
推荐指数
1
解决办法
5939
查看次数

将应用程序内购买添加到现有已发布的应用程序并在不发布的情

我正在尝试为以前没有结算权限的现有已发布应用添加应用内购买.我已经上传了具有结算权限的已更新APK,但由于我不想发布此草稿,因此未激活它.但是,我无法添加应用内商品 - 它仍然说"当前应用程序版本不使用BILLING权限".有什么方法可以解决/解决这个问题吗?

android in-app-purchase in-app-billing android-billing

8
推荐指数
1
解决办法
1330
查看次数

IabHelper Android bug(NullPointerException)launchPurchaseFlow?

我正在使用Google提供的应用内结算的最新版本文件.今天我下载应用程序时手机出现错误(我试图重复这些步骤,但错误不再出现).

让我们说在我的MainActivity中我有一个按钮,用户可以购买一些应用内商品.我的活动调用这个构造函数:

public void launchPurchaseFlow(Activity act, String sku, int requestCode, OnIabPurchaseFinishedListener listener) {
    launchPurchaseFlow(act, sku, requestCode, listener, "");
}
Run Code Online (Sandbox Code Playgroud)

通过这种方式:

mHelper.launchPurchaseFlow(MainActivity.this, SKU_UNLOCKED, RC_REQUEST,
                                mPurchaseFinishedListener, "");
Run Code Online (Sandbox Code Playgroud)

今天我得到了这个NullPointerException错误:

java.lang.NullPointerException
        at xxx.xxx.xxxxx.util.IabHelper.launchPurchaseFlow(IabHelper:386)
        at xxx.xxx.xxxxx.util.IabHelper.launchPurchaseFlow(IabHelper:338)
        at xxx.xxx.xxxxx.MainActivity$6.onClick(MainActivity:422)
Run Code Online (Sandbox Code Playgroud)

MainActivity的第422行是mHelper.launch ...... IabHelper的第338行是构造函数.

然后在launchePurchaseFlow中:

386行:

Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, extraData);
Run Code Online (Sandbox Code Playgroud)

这是try-catch块的内部:

try {
        logDebug("Constructing buy intent for " + sku + ", item type: " + itemType);
        Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, extraData);
        int response = getResponseCodeFromBundle(buyIntentBundle);
        if (response != BILLING_RESPONSE_RESULT_OK) { …
Run Code Online (Sandbox Code Playgroud)

java android nullpointerexception in-app-billing android-billing

8
推荐指数
0
解决办法
1461
查看次数

Android IABv3 getSkuDetails没有返回Sku详细信息

我目前正在与Android Iab v3作斗争.

我以前一直在使用Google的IabHelper类来显示成功的可用产品.然而,今天它不再给我任何回报.

传递给IabHelper类中IInAppBillingService的getSkuDetails函数的querySku字段的内容是:

捆绑[{ITEM_ID_LIST = [com.app.android.credits.10,com.app.android.credits.25,com.app.android.credits.50]}]

我在返回的包中得到的是:

捆绑[{DETAILS_LIST = [],RESPONSE_CODE = 0}]

从它工作的时间开始,现在我根本没有改变IabHelper代码以及显示产品的代码.代码的重要部分是:

private void getItemsForSale()
{
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.add(getResources().getString(R.string.ten_credits_product_id));
    skuList.add(getResources().getString(R.string.twenty_credits_product_id));
    skuList.add(getResources().getString(R.string.fifty_credits_product_id));

    mHelper.queryInventoryAsync(true, skuList, this);
}

@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv)
{
    if(result.isFailure())
    {
         Log.d("DEBUG", "Error Inventory Query: " + result);
         AppMsg.makeText(BuyCreditsActivity.this, R.string.sorry_something_went_wrong, AppMsg.STYLE_ALERT).show();  
    }
    else
    {
         // Code here queries the inv object returned which has a blank array
    }
}
Run Code Online (Sandbox Code Playgroud)

这就是为什么我这么困惑.

有没有人知道外部因素可能导致开始没有返回任何产品细节?

android android-billing

8
推荐指数
2
解决办法
7543
查看次数

确定退款的Play商店下载

Play商店现在会在购买后2小时内自动批准退款.我有一个Android应用程序,人们可以从应用程序创建和控制VPS游戏主机.也就是说,当你启动应用程序时,你会经历一个注册流程,之后你会有一个运行游戏的VPS.注册后,如果您想对VPS进行任何更改,您只需要该应用程序.

我看到人们通过购买应用程序(提供30天免费VPS)来滥用此功能,通过注册流程创建他们的VPS,然后他们要求退款(如果在2小时内自动获得批准).

从谷歌钱包我可以看到哪些订单ID被取消,但我如何将其链接回用户设备ID或我可以在应用程序中获取的其他东西?

我强迫用户在完成注册流程之前申报他们的Google用户帐户:

Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null);
// ...
email = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
Run Code Online (Sandbox Code Playgroud)

但这只会给我他们的电子邮件地址,我无法链接回订单ID,这是Google电子钱包中唯一的标识符.

如何将其帐户/电子邮件/设备ID与订单ID(或Google电子钱包中提供的其他信息)相关联?

请注意:这不适用于订单ID随时可用的应用内购买.这是购买应用程序.

谢谢!

修改:Google Play服务授权和用户帐户管理无法让您一直到订单ID:http://developer.android.com/google/auth/http-auth.html 以下是有关应用内结算的文档(毫不奇怪)不提供任何获取应用程序采购订单ID信息的方法:http://developer.android.com/google/play/billing/billing_reference.html 许可不提供订单ID :http:// developer .android.com /谷歌/播放/许可/ overview.html

有类似问题但也未得到答复的人:http://pcandsys.com/20378/verify-purchase-in-google-play-by-orderid / b3

android in-app-billing google-play android-pay android-billing

8
推荐指数
1
解决办法
840
查看次数

Android Play Billing Library:onSkuDetailsResponse responseCode为0,但skuDetailsList的大小也为0

我现在正在使用新的Play Billing Library

基本上,我按照文档查询要购买的可用项目

 SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
            params.setSkusList(skuList).setType(itemType);
            mBillingClient.querySkuDetailsAsync(params.build(),
                    new SkuDetailsResponseListener() {

                        @Override
                        public void onSkuDetailsResponse(int responseCode,
                                                         List<SkuDetails> skuDetailsList) {
                            listener.onSkuDetailsResponse(responseCode, skuDetailsList);
                        }
Run Code Online (Sandbox Code Playgroud)

但是,responseCode为0,列表也为空.但我检查了BillingSetupFinished是否成功.提供给SkuDetailsParams.Builder的skuList不为空,skuList(sku_id)中的值也与Google Play控制台上指定的产品ID相同.

有谁知道原因?谢谢!!

android android-billing android-inapp-purchase play-billing-library

8
推荐指数
4
解决办法
3528
查看次数

验证应用内购买

示例应用程序在谷歌开发者指南是指有一个名为方法verifyValidSignature(),看起来像这样的BillingManager类:

/**
 * Verifies that the purchase was signed correctly for this developer's public key.
 *
 * Note: It's strongly recommended to perform such check on your backend since hackers can
 * replace this method with "constant true" if they decompile/rebuild your app.
 */
private boolean verifyValidSignature(String signedData, String signature) {
    try {
        return Security.verifyPurchase(BASE_64_ENCODED_PUBLIC_KEY, signedData, signature);
    } catch (IOException e) {
        Log.e(TAG, "Got an exception trying to validate a purchase: " …
Run Code Online (Sandbox Code Playgroud)

android in-app-purchase in-app-billing android-billing android-inapp-purchase

8
推荐指数
0
解决办法
686
查看次数

在静态代码中的应用购买错误

我正在使用当前代码购买来调用购买意图

Bundle buyIntentBundle = mService.getBuyIntent(3, pContext.getPackageName(), "android.test.canceled", "inapp", "bGoa+V7g/yqDXv");
Set<String> allKeys = buyIntentBundle.keySet();
Object  responseCode= buyIntentBundle.get("RESPONSE_CODE");
Object  intent= buyIntentBundle.get("BUY_INTENT");
Log.i(TAG,"buyIntentBundle"+buyIntentBundle.keySet()+"responseCode"+responseCode+"intent"+intent);
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
if (pendingIntent != null) {
    pContext.startIntentSenderForResult(pendingIntent.getIntentSender(), 2013, new Intent(), Integer.valueOf(0), Integer.valueOf(0),Integer.valueOf(0));
}
Run Code Online (Sandbox Code Playgroud)

现在onActivityResult我正在检查

if (requestCode == 2013) {           
    Log.i(TAG, "onactivity result called inside request code");
    int responseCode = intent.getIntExtra("RESPONSE_CODE", 0);
    String purchaseData = intent.getStringExtra("INAPP_PURCHASE_DATA");
    String dataSignature = intent.getStringExtra("INAPP_DATA_SIGNATURE");      
    if (responseCode == Constants.BILLING_RESPONSE_RESULT_OK) {
    try {
        JSONObject jo = new JSONObject(purchaseData);
        String sku = jo.getString("productId");
        Toast.makeText(pContext, "You …
Run Code Online (Sandbox Code Playgroud)

android in-app-purchase android-intent in-app-billing android-billing

7
推荐指数
1
解决办法
2158
查看次数

Google Play In-app Billing API version is less than 3

I just started beta testing the 2.0 update to the billing library for the Play Store and a lot of my users are getting this error Google Play In-app Billing API version is less than 3.

这只是更新之前的时间问题,还是某些设备卡在旧版本上还是什么?

android android-billing android-inapp-purchase

7
推荐指数
3
解决办法
918
查看次数