getPurchases()抛出RemoteException

时间:2018-04-02 11:25:06

标签: java android in-app-purchase

当尝试使用getPurchases()查询应用内购买时,我无法弄清楚如何复制问题,但有时会抛出RemoteException。我有一个try-catch块,但是

Bundle ownedItems;
try {
    ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
} catch (RemoteException e) {
    // What do I put here?
}

是什么导致RemoteException被抛出,是否可以预防?我怎样才能看到它被抛出后的购买情况?我需要能够看到已经进行了哪些购买。我已经搜索过,但没有找到任何关于此的细节。

编辑:这是堆栈跟踪

Exception android.os.DeadObjectException:
android.os.BinderProxy.transactNative (Binder.java)
android.os.BinderProxy.transact (Binder.java:617)
com.android.vending.billing.IInAppBillingService$Stub$Proxy.getPurchases (IInAppBillingService.java:348)
abraham.johnson.app.MainActivity.isNoAdsPurchased (MainActivity.java:1154)
abraham.johnson.app.MainActivity.access$000 (MainActivity.java:62)
abraham.johnson.app.MainActivity$1.onServiceConnected (MainActivity.java:80)
android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:1579)
android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1607)
android.os.Handler.handleCallback (Handler.java:761)
android.os.Handler.dispatchMessage (Handler.java:98)
android.os.Looper.loop (Looper.java:156)
android.app.ActivityThread.main (ActivityThread.java:6523)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:942)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:832)

0 个答案:

没有答案