I have an app that display live stream video. I want to display advertisements in between the live video stream. For that I need to continuously receive adds from another server and store in current device. From server i am getting information like video and at what time it should play, When my app is running. So I want to receive the video content even though my app is killed/background/suspended/terminated. So that I can play the advertisement at that particular time. how to receive the content. Tell me the possible cases to do that or any suggestions.
Asked
Active
Viewed 533 times
0
-
If you're app's not running, it's not running. You could try background fetching or sending notifications, hoping that iOS wakes up your app. – Avi Jul 21 '16 at 07:21
-
I can simply say you that- it is not possible – Mehul Thakkar Jul 21 '16 at 07:22
-
If you are downloading video from server then simply use NSURLSession's background transfer property. I – Gagan_iOS Jul 21 '16 at 07:32
-
It is possible using push kit. – Hasya Jul 21 '16 at 07:43
-
thanks for the reply, is there any way to create a service to OS through X code, so that we can be able to give instructions to the OS not to stop receiving advertisements from server and store it in local dataBase.Thanks in advance. – Smart guy Jul 21 '16 at 13:29
1 Answers
-1
You have to use push kit library.
When you get push kit payload your app will get invoke in background even it is in kill ( terminated ) state.
Making "content-available": 1 in push kit payload, it will be silent push notification.
{
"aps": {
"content-available": 1,
"data": "Any specific data you want to pass"
}
}
This data tag can have your details to work like JSON data, string, etc etc
Then you can perform any operation like DB, logic etc. only UI related things would not be preferable.

Hasya
- 9,792
- 4
- 31
- 46
-
thanks for the reply, but if user stops receiving notifications in his device it will be a trouble to my app right or is there any way to send notification even though user stops it – Smart guy Jul 21 '16 at 13:25
-
So then there is no way, change your structure. because getting data on killed state there is only a option using push kit. If you find any other way and gets success, please put it here. Thanks. – Hasya Jul 21 '16 at 13:31