Skip to content

Commit febf45e

Browse files
committed
Always notify observers in checkBillingSupported
1 parent b111243 commit febf45e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

AndroidBillingLibrary/src/net/robotmedia/billing/BillingController.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ private static final void addManualConfirmation(String itemId, String notificati
103103
}
104104

105105
/**
106-
* Returns the billing status. If it is currently unknown, checks the billing
107-
* status asynchronously, in which case observers will eventually receive
108-
* a {@link IBillingObserver#onBillingChecked(boolean)} notification.
106+
* Returns the billing status. If it is currently unknown, checks the
107+
* billing status asynchronously. Observers will receive a
108+
* {@link IBillingObserver#onBillingChecked(boolean)} notification in either
109+
* case.
109110
*
110111
* @param context
111112
* @return the current billing status (unknown, supported or unsupported).
@@ -114,6 +115,9 @@ private static final void addManualConfirmation(String itemId, String notificati
114115
public static BillingStatus checkBillingSupported(Context context) {
115116
if (status == BillingStatus.UNKNOWN) {
116117
BillingService.checkBillingSupported(context);
118+
} else {
119+
boolean supported = status == BillingStatus.SUPPORTED;
120+
onBillingChecked(supported);
117121
}
118122
return status;
119123
}

AndroidBillingLibraryTest/src/net/robotmedia/billing/BillingControllerTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ protected void setUp() throws Exception {
4646
mData = new BillingDB(getContext());
4747
}
4848

49+
@SmallTest
50+
public void testCheckBillingSupported() throws Exception {
51+
BillingController.checkBillingSupported(getContext());
52+
}
53+
4954
@MediumTest
5055
public void testIsPurchased() throws Exception {
5156
assertFalse(BillingController.isPurchased(getContext(), TransactionTest.TRANSACTION_1.productId));

0 commit comments

Comments
 (0)