gpt4 book ai didi

android - Billingservice Android - 无签名

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:39:13 24 4
gpt4 key购买 nike

我已经遵循以下很棒的教程:http://blog.blundell-apps.com/simple-inapp-billing-payment/

我已经完成了教程中所说的所有内容,并再次阅读了所有内容 3 遍,但我仍然没有在 onReceive() 的 intent.getStringExtra(INAPP_SIGNATURE) 中收到签名:BillingReceiver .java

这使我的应用程序崩溃,因为该应用程序无法比较签名以验证购买是否正确完成。

这是我的 BillingReceiver 的样子:

public class BillingReceiver extends BroadcastReceiver {

private static final String TAG = "BillingService";

@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.i(TAG, "Received action: " + action);
if (ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
String signedData = intent.getStringExtra(INAPP_SIGNED_DATA);
String signature = intent.getStringExtra(INAPP_SIGNATURE);
Log.e(TAG, "<!-- SIGNATURE : "+ intent.getExtras().getString("inapp_signature"));


Log.i(TAG, "<!-- SIGNATURE : "+intent.getStringExtra(INAPP_SIGNATURE));

purchaseStateChanged(context, signedData, signature);
} else if (ACTION_NOTIFY.equals(action)) {
String notifyId = intent.getStringExtra(NOTIFICATION_ID);
notify(context, notifyId);
} else if (ACTION_RESPONSE_CODE.equals(action)) {
long requestId = intent.getLongExtra(INAPP_REQUEST_ID, -1);
int responseCodeIndex = intent.getIntExtra(INAPP_RESPONSE_CODE, C.ResponseCode.RESULT_ERROR.ordinal());
checkResponseCode(context, requestId, responseCodeIndex);
} else {
Log.e(TAG, "unexpected action: " + action);
}
}

private void purchaseStateChanged(Context context, String signedData, String signature) {
Log.i(TAG, "purchaseStateChanged got signedData: " + signedData);
Log.i(TAG, "purchaseStateChanged got signature: " + signature);
BillingHelper.verifyPurchase(signedData, signature);
}

private void notify(Context context, String notifyId) {
Log.i(TAG, "notify got id: " + notifyId);
String[] notifyIds = {notifyId};
BillingHelper.getPurchaseInformation(notifyIds);
}

private void checkResponseCode(Context context, long requestId, int responseCodeIndex) {
Log.i(TAG, "checkResponseCode got requestId: " + requestId);
Log.i(TAG, "checkResponseCode got responseCode: " + C.ResponseCode.valueOf(responseCodeIndex));
}
}

最佳答案

您测试设备上的主帐户是否与您的 Google Play 开发者帐户相同?

否则,您将不会在 android.test.* 静态响应上获得签名,除非该应用之前已在 Play 上发布。

请参阅 http://developer.android.com/guide/market/billing/billing_testing.html#static-responses-table 处的表格对于全套条件。

关于android - Billingservice Android - 无签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9790125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com