添加全局监听
添加全局的监听,在发生购买、续期订阅、恢复购买之后全局监听都会被调用。开发者应该在初始化之后尽早的设置监听,以便及时的监听回调
- Java
- Kotlin
- Objective-C
- Swift
///Adding a listener
UserOrderManager.getProvider().addPurchaseObserver(new OrderObserver() {
@Override
public void onUpdateOrders(List<MTGPurchase> purchases) {
// Monitor order changes
}
});
///Remove listener
UserOrderManager.getProvider().removePurchaseObserver(orderObserver);
///Adding a listener
UserOrderManager.getProvider().addPurchaseObserver {
//Monitoring order changes
}
///Remove listener
UserOrderManager.getProvider().removePurchaseObserver(orderObserver)
///Adding a listener
[AWPurchaseKit addPurchaseObserver:AWPurchaseObserver];
///Remove listener
[AWPurchaseKit removePurchaseObserver:self];
///Adding a listener
AWPurchaseKit.add(AWPurchaseObserver)
///Remove listener
AWPurchaseKit.remove(AWPurchaseObserver)