Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do tvOS transmissions stay active since there is no drain on battery?

Tags:

tvos

Two part question:

First, does the Apple TV run app activities in the background while it is asleep? I would assume this would be the case since the Apple TV isn't relying on battery.

Second, if this is not the case, how would I override this keep an app running and writing to my database?

I am building an app that connects to Bluetooth LE, then writes to a database after connecting. I would like the Apple TV to be the "hub" for my device. So as long as the Apple TV can stay awake, unlike iOS, I should be fine. I could be looking at this the wrong way. Please feel free to correct me.

like image 502
temp_ Avatar asked Dec 02 '16 18:12

temp_


1 Answers

tvOS runs the same application state mechanism that iOS does. Meaning it has the same old:

not running > suspended > background > inactive > active

This also means that it will do basic background processing based on very specific background tasks you specify, just like iOS. Though, tvOS does not have a background data-refresh function, which I'd imagine you'd want to use for the scenario you described.

Check out this Apple doc for more modes. https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22


To specifically, answer the question: There may be a way to do some background data work, but it would be very limited; And you can prevent sleep programmatically by doing:

[UIApplication sharedApplication].idleTimerDisabled = YES;

This apple doc will give you all you need to accomplish this. https://developer.apple.com/documentation/uikit/uiapplication

like image 73
Chris J Avatar answered Jan 02 '23 11:01

Chris J