2222import android .os .Handler ;
2323import android .os .RemoteException ;
2424import android .text .TextUtils ;
25+ import android .util .Log ;
26+
2527import com .bazaar .util .communication .BillingSupportCommunication ;
2628import com .bazaar .util .communication .OnConnectListener ;
2729import java .util .ArrayList ;
@@ -120,6 +122,8 @@ public class IabHelper {
120122 public static final String GET_SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST" ;
121123 public static final String GET_SKU_DETAILS_ITEM_TYPE_LIST = "ITEM_TYPE_LIST" ;
122124
125+ public static final String TAG = "[BazaarAIB][Plugin]" ;
126+
123127 /**
124128 * Creates an instance. After creation, it will not yet be ready to use. You must perform
125129 * setup by calling {@link #startSetup} and wait for setup to complete. This constructor does not
@@ -161,8 +165,11 @@ public interface OnIabSetupFinishedListener {
161165 * @param result The result of the setup process.
162166 */
163167 public void onIabSetupFinished (IabResult result );
168+
169+ public void onServiceDisconnected ();
164170 }
165171
172+
166173 /**
167174 * Starts the setup process. This will start up the setup process asynchronously.
168175 * You will be notified through the listener when the setup process is complete.
@@ -180,9 +187,22 @@ public void startSetup(final OnIabSetupFinishedListener listener) {
180187
181188 OnConnectListener connectListener = new OnConnectListener () {
182189 @ Override
183- public void connected (IAB iabService ) {
190+ public void connected (IAB iabService )
191+ {
184192 checkBillingSupported (listener , iabService );
185193 }
194+
195+ @ Override
196+ public void disconnected (IAB iabService )
197+ {
198+ //dispose current connection and helper
199+ if (iabConnection == iabService )
200+ {
201+ dispose ();
202+
203+ listener .onServiceDisconnected ();
204+ }
205+ }
186206 };
187207
188208 IAB serviceIAB = new ServiceIAB (logger );
0 commit comments