@Override public void cancel() { Billing.cancel(mListener); } }
@Override public void cancel() { Billing.cancel(mListener); } }
/** * Cancels this request, after this method is called request listener method will not be called */ void cancel() { synchronized (this) { if (mListener != null) { Billing.cancel(mListener); } mListener = null; } }
/** * Cancels this purchase flow. * Note that cancelling the purchase flow is not the same as cancelling the purchase process as * purchase process is not controlled by the app. This method only guarantees that there will be * no more calls of {@link RequestListener}'s methods. */ @Override public void cancel() { if (mListener == null) { return; } Billing.cancel(mListener); mListener = null; }
public final void cancel() { onCancel(); Billing.cancel(mListener); }
@Test public void testShouldCancelRequests() throws Exception { final int REQUESTS = 10; final Billing b = Tests.newBilling(false); final CountDownLatch latch = new CountDownLatch(REQUESTS / 2); final RequestListener l = new CountDownListener(latch); final List<Integer> requestIds = new ArrayList<Integer>(); for (int i = 0; i < REQUESTS; i++) { requestIds.add(b.runWhenConnected(new SleepingRequest(100), l, null)); } Thread.sleep(100 * (REQUESTS / 2 - 1)); for (int i = REQUESTS / 2; i < REQUESTS; i++) { b.cancel(requestIds.get(i)); } assertTrue(latch.await(1, SECONDS)); }