int getResponseCodeFromIntent(Intent i) {
        Object o = i.getExtras().get(RESPONSE_CODE);
        if (o == null) {
            logError("Intent with no response code, assuming OK (known issue)");
            return BILLING_RESPONSE_RESULT_OK;
        }
        else if (o instanceof Integer) return ((Integer)o).intValue();
        else if (o instanceof Long) return (int)((Long)o).longValue();
        else {
            logError("Unexpected type for intent response code.");
            logError(o.getClass().getName());
            throw new RuntimeException("Unexpected type for intent response code: " + o.getClass().getName());
        }
    }
int getResponseCodeFromIntent ( Intent i ) { Object o = i . getExtras ( ) . get ( RESPONSE_CODE ) ; if ( o == null ) { logError ( "Intent with no response code, assuming OK (known issue)" ) ; return BILLING_RESPONSE_RESULT_OK ; } else if ( o instanceof Integer ) return ( ( Integer ) o ) . intValue ( ) ; else if ( o instanceof Long ) return ( int ) ( ( Long ) o ) . longValue ( ) ; else { logError ( "Unexpected type for intent response code." ) ; logError ( o . getClass ( ) . getName ( ) ) ; throw new RuntimeException ( "Unexpected type for intent response code: " + o . getClass ( ) . getName ( ) ) ; } }
Workaround to bug where sometimes response codes come as Long instead of Integer