I am working on some study in sending the data from iphone to server, and I want to keep the communication even when my program is working on the background mode.
For the details, when my program monitors the beacon' signal with special UUID by Corelocation( in other words, the iphone is taken into the beacon'region), then in Corelocation's handling function, the dataTask of URLSession will be excuted to forward the BLE signal's information to server.
Because the beacon sends the BLE signal periodically and continuously, I think the data will be sent from iphone to sever with my program continuously.
But now, my experiment result is, when I change the application into background:
-sometimes, the dataTask can be kept for several hours or one or two days without any problem
-sometimes, the dataTask will be stopped and after several minutes, it will be restarted automatically (really confusing). And in this case, I find the BLE monitoring program is kept to work, only the dataTask communication has been stopped
-
I want to know the reason and the dataTask's action condition of the above phenomenon such as keeping or stoping or restarting the communication.
-
Is there any method to keep the communication between the iphone and server without any interruption?
Thanks a lot!