Billingservice Android - No Signature

I followed the following great tutorial: http://blog.blundell-apps.com/simple-inapp-billing-payment/

I did everything that the textbook says and read it all three times, but still I don't get the signature in intent.getStringExtra(INAPP_SIGNATURE) in onReceive() : BillingReceiver.java

which causes my app to crash because the app can not compare signatures to see if the purchase was completed correctly.

Here's what my BillingReceiver looks like:

 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)); } } 
+5
android signature in-app-billing
Mar 20 2018-12-12T00:
source share
1 answer

Is the primary account for your test device the same as your Google Play developer account?

If not, you will not receive signatures in android.test. * static response if the application has not been published to Play before.

See the table at http://developer.android.com/guide/market/billing/billing_testing.html#static-responses-table for a complete set of conditions.

+5
May 25 '12 at 12:51
source share



All Articles