|
|
@ -68,6 +68,7 @@ import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
public class ActivityBilling extends ActivityBase implements PurchasesUpdatedListener, FragmentManager.OnBackStackChangedListener {
|
|
|
|
public class ActivityBilling extends ActivityBase implements PurchasesUpdatedListener, FragmentManager.OnBackStackChangedListener {
|
|
|
|
|
|
|
|
private boolean standalone = false;
|
|
|
|
private BillingClient billingClient = null;
|
|
|
|
private BillingClient billingClient = null;
|
|
|
|
private List<IBillingListener> listeners = new ArrayList<>();
|
|
|
|
private List<IBillingListener> listeners = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
@ -88,6 +89,8 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
|
|
|
|
protected void onCreate(Bundle savedInstanceState, boolean standalone) {
|
|
|
|
protected void onCreate(Bundle savedInstanceState, boolean standalone) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.standalone = standalone;
|
|
|
|
|
|
|
|
|
|
|
|
if (standalone) {
|
|
|
|
if (standalone) {
|
|
|
|
setContentView(R.layout.activity_billing);
|
|
|
|
setContentView(R.layout.activity_billing);
|
|
|
|
|
|
|
|
|
|
|
@ -120,12 +123,14 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
|
|
|
|
protected void onResume() {
|
|
|
|
protected void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
|
|
|
if (standalone) {
|
|
|
|
IntentFilter iff = new IntentFilter();
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
|
|
|
iff.addAction(ACTION_PURCHASE);
|
|
|
|
IntentFilter iff = new IntentFilter();
|
|
|
|
iff.addAction(ACTION_PURCHASE_CONSUME);
|
|
|
|
iff.addAction(ACTION_PURCHASE);
|
|
|
|
iff.addAction(ACTION_PURCHASE_ERROR);
|
|
|
|
iff.addAction(ACTION_PURCHASE_CONSUME);
|
|
|
|
lbm.registerReceiver(receiver, iff);
|
|
|
|
iff.addAction(ACTION_PURCHASE_ERROR);
|
|
|
|
|
|
|
|
lbm.registerReceiver(receiver, iff);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (billingClient != null && billingClient.isReady())
|
|
|
|
if (billingClient != null && billingClient.isReady())
|
|
|
|
queryPurchases();
|
|
|
|
queryPurchases();
|
|
|
@ -135,8 +140,10 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
|
|
|
|
protected void onPause() {
|
|
|
|
protected void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
super.onPause();
|
|
|
|
|
|
|
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
|
|
|
if (standalone) {
|
|
|
|
lbm.unregisterReceiver(receiver);
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
|
|
|
|
|
|
|
lbm.unregisterReceiver(receiver);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|