I'm getting exception reports of DeadObjectException from some devices when requesting prices for in app purchases. The exception occurs when I call getSkuDetails on my billing service connection.
I don't find the documentation on this particularly clear.
The object you are calling has died, because its hosting process no longer exists.
- Am I understanding this correctly if I assume that the billing service has been killed by Android for some reason?
- Why?
- Is there a way to stop this from happening?
- Should I stop this from happening?
- How should I deal with the exception?
- Is there a way I can reproduce this scenario for testing?
I have two methods
void bindToBillingService() {
AndroidLauncher.getActivity().bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"),
mServiceConn, Context.BIND_AUTO_CREATE);
}
public void unbindBillingService() {
if (getBillingServiceConnection() != null) {
AndroidLauncher.getActivity().unbindService(mServiceConn);
}
}
Should I be doing something like this?
try {
// Do something billing related
} catch (DeadObjectException e) {
unbindBillingService();
bindToBillingService();
// Wait for a connection and then try again
}