12

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.

  1. Am I understanding this correctly if I assume that the billing service has been killed by Android for some reason?
  2. Why?
  3. Is there a way to stop this from happening?
  4. Should I stop this from happening?
  5. How should I deal with the exception?
  6. 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
    }
Will Calderwood
  • 4,393
  • 3
  • 39
  • 64
  • possible duplicate of [Android RemoteExceptions and Services](http://stackoverflow.com/questions/3156389/android-remoteexceptions-and-services) – corsair992 Jan 30 '15 at 07:42

0 Answers0