1

我根据地牢示例使用代码。除了一件事,一切都很好。事情是恢复交易。当我以与示例中相同的方式调用恢复事务时,一切似乎都很好。看起来他没有产生任何错误。但后来我等了 3 到 10 分钟(我认为这足以获得 eosrom 谷歌服务器)。但没有回应......我点kof我做某事......??

这是我用于恢复传输的代码...

mBillingService.restoreTransactions(); 

public boolean restoreTransactions() {
    return new RestoreTransactions().runRequest();
}
class RestoreTransactions extends BillingRequest {
    long mNonce;

    public RestoreTransactions() {
        // This object is never created as a side effect of starting this
        // service so we pass -1 as the startId to indicate that we should
        // not stop this service after executing this request.
        super(-1);
    }

    @Override
    protected long run() throws RemoteException {
        mNonce = Security.generateNonce();

        Log.d("running", "running restore request");
        Bundle request = makeRequestBundle("RESTORE_TRANSACTIONS");
        request.putLong(Consts.BILLING_REQUEST_NONCE, mNonce);
        Bundle response = mService.sendBillingRequest(request);
        logResponseCode("restoreTransactions", response);
        return response.getLong(Consts.BILLING_RESPONSE_REQUEST_ID,
                Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
    }

    @Override
    protected void onRemoteException(RemoteException e) {
        super.onRemoteException(e);
        Security.removeNonce(mNonce);
    }

    @Override
    protected void responseCodeReceived(ResponseCode responseCode) {
        ResponseHandler.responseCodeReceived(BillingService.this, this, responseCode);
    }
}   

这实际上与地牢样本相同。但我没有得到这个片段的回应。但是,如果我想购买一件物品,那是没有问题的。那么有谁知道如何解决这个问题?我收到购买回复,但没有回复回复....

毕竟,如果我完成我的意图并完成我的应用程序,则会发生以下错误。似乎响应是在应用程序结束之后出现的。它不是在运行期间出现,而是在完成所有意图之后出现。

另一个奇怪的事情是,在销毁时,我正在取消绑定服务和计费上下文。那么事实上,这应该被调用吗?我想不是 ?

有谁知道如何解决这个问题?提前致谢!

在下面记录猫错误。

12-24 01:33:06.212: E/AndroidRuntime(27721): FATAL EXCEPTION: main
        12-24 01:33:06.212: E/AndroidRuntime(27721): java.lang.RuntimeException: Unable to start        service .BillingService@40da8db0 with null: java.lang.NullPointerException
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2749)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.app.ActivityThread.access$1900(ActivityThread.java:139)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.os.Handler.dispatchMessage(Handler.java:99)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.os.Looper.loop(Looper.java:156)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.app.ActivityThread.main(ActivityThread.java:4987)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at java.lang.reflect.Method.invokeNative(Native Method)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at java.lang.reflect.Method.invoke(Method.java:511)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at dalvik.system.NativeStart.main(Native Method)
    12-24 01:33:06.212: E/AndroidRuntime(27721): Caused by: java.lang.NullPointerException
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at .BillingService.handleCommand(BillingService.java:431)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at .BillingService.onStart(BillingService.java:421)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.app.Service.onStartCommand(Service.java:438)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2726)
    12-24 01:33:06.212: E/AndroidRuntime(27721):    ... 10 more
4

0 回答 0