4

We have an app with discount coupons, we want our users to be able redeem (its is api an call) coupons even when there is no internet. So what we want is to queue all the redeem calls and send them once internet is available. Even when app is in background. We are currently using Alamofire as our networking library so if it can be done through `Alamofire. it would be more easier for us.

Thanks

Kashan Danish
  • 155
  • 2
  • 9
  • Please refer the link which help you http://stackoverflow.com/questions/35427698/how-to-use-networkreachabilitymanager-in-alamofire – Ramkrishna Sharma Dec 02 '16 at 12:44
  • @RamkrishnaSharma if I understood the question you mentioned correctly, it about detecting change in network state. That is but a small part of my problem. – Kashan Danish Dec 02 '16 at 13:10
  • I hope you have a CoreData(or any storage) model where you have these redeemable coupons. So in offline mode if a user uses a redeem coupon, mark the coupon as 'USED=true' and 'SYNCED=false'. Whenever user gets online query all the (USED==true && SYNCED==false) coupons and queue them up using Alamofire. 'USED' & 'SYNCED' are two boolean attributes which I have used as example. – Pranav Jaiswal Dec 02 '16 at 13:54
  • Thanks @PranavJaiswal but we are not having problem with the model/architecture, the problem is rather technical. when you said "queue them using Alamofire", _that_ is the probelm along side how to send queued request when app is closed. – Kashan Danish Dec 02 '16 at 15:42

0 Answers0