Fix crash if purchase service not available
This commit is contained in:
parent
82d804587a
commit
d8913ef63a
1 changed files with 6 additions and 4 deletions
|
@ -298,6 +298,7 @@ public class InAppPurchaseHelper {
|
||||||
|
|
||||||
if (buyIntentBundle != null) {
|
if (buyIntentBundle != null) {
|
||||||
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
|
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
|
||||||
|
if (pendingIntent != null) {
|
||||||
try {
|
try {
|
||||||
((Activity) mContext).startIntentSenderForResult(pendingIntent.getIntentSender(), ACTIVITY_RESULT_CODE_PURCHASE_ITEM, new Intent(), 0, 0, 0);
|
((Activity) mContext).startIntentSenderForResult(pendingIntent.getIntentSender(), ACTIVITY_RESULT_CODE_PURCHASE_ITEM, new Intent(), 0, 0, 0);
|
||||||
} catch (SendIntentException e) {
|
} catch (SendIntentException e) {
|
||||||
|
@ -305,6 +306,7 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void purchaseItemAsync(final String productId, final String sipIdentity) {
|
public void purchaseItemAsync(final String productId, final String sipIdentity) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
|
|
Loading…
Reference in a new issue