0

Basically I need to create a Beacon for my application to send the packet to my server in every 15 min till my application is in my device.

I need to send in every state of my application bather about the application is in frontend or back end.

Please suggest , what I should go with

  1. Timer in a run looop
  2. Background fetch.

Thanks in advance.

Myaaoonn
  • 1,001
  • 12
  • 25
  • Are you trying to send detected beacon packets to the server? If so, you can probably just use the didRangeBeacons callback (which fires once per second) and only send the detected packets to the server if it has been 15 minutes since the last send. No fancy timers necessary. – davidgyoung Dec 12 '17 at 13:16

1 Answers1

-1

Go for timer in runloop. Set it to trigger every 15 mins. But remember if the app is removed from background then it will not work.

Rahul Dasgupta
  • 894
  • 6
  • 18
  • but according to this link https://stackoverflow.com/questions/37215537/what-is-an-nstimers-behavior-when-the-app-is-backgrounded , I cannot get as expected. do you have any example – Myaaoonn Dec 12 '17 at 12:09
  • Soory dude my mistake. It cannot be done until app is doing some background task. This is also not guaranteed. – Rahul Dasgupta Dec 12 '17 at 12:33