Do tvOS transmissions stay active since there is no drain on battery? - 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.

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

Related

Run Windows Phone App in background without UI

I am developing a Windows phone 8 app that need to run only in background with UI. Is there any way I can run the app in the background, or without actually being open?
It depends upon what you want to do in the background. Generally speaking you can't implement something like a Windows service that will startup automatically when the phone is launched.
That said you can run your app in the background within given limitations. Check out MSDN for detailed information.
Why all these limitations you might ask yourself? It's to provide a good battery life to the user.
Edit:
For the periodic agent to start running the app must be started once. Further the agent must update a live tile (user must pin it to the start screen) or the app has to be once opened every 14 days.
Another option might be using push notifications to trigger an update..

Speech recognition api in a background agents on Windows Phone 8

My question -I want to use speech recognition API that work when application is in background. Is it possible.
While the speech APIs aren't in the list of Unsupported APIs for background agents for Windows Phone this does surprise me.
I suspect that you are actually trying to have an application which is always listening in the background but this is not what a background agent will do. At best it will only run periodically (approx. 25 seconds every 30 mins) and I assume that's not what you want.
There is no way to create an app that is always running in the background. Regardless of whether it is doing speech recognition.
I have never actually tried this, but I'd say I doubt that it is possible for the following reasons.
1) Background tasks run for a limited time period at a specific interval. The chances of the agent being active when you want it to be are very slight.
2) How would you notify your agent that you want to give it voice input if your UI is not running?

Windows Phone 8 - Keeping background location tracking active beyond four hours

I'm in the process of developing a WP8 app that makes use of the background location tracking abilities provided by the OS. The idea is to monitor the users position and to notify them when they are near certain types of places.
So far it all seems to work fine and when running the location tracking works as I would expect.
The problem is, it seems that the phone times out background apps after around four hours, stopping the location tracking.
I can understand why Microsoft did it, to preserve battery life etc. But there's not much point having a background location tracking app that has to be manually restarted every four hours! If a user chooses to run this app and is made aware of the potential battery hit, surely it should be able to run indefinitely - to a point of course, if the system runs out of resources or similar then that's fair enough.
Does anyone have any experience with this? There must be hundreds of others apps in the store that have run into this issue I would have thought? And presumably there must be some way of keeping the location tracking running?
I've tried periodically updating the live tile (using a DispatcherTimer) while the tracking is running but this doesn't seem to be enough to keep the app alive either :(
Anyone have any ideas?
Thanks.
There is no way to achieve your desired behavior. The app will be deactivated under anye of following conditions:
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and StatusChanged events of the Geolocator class or by calling the Stop() method of the GeoCoordinateWatcher class.
The app has run in the background for 4 hours without user interaction.
Battery Saver is active.
Device memory is low.
The user disables Location Services on the phone.
Another app begins running in the background.
Source: Running location-tracking apps in the background for Windows Phone 8
What you could do is to show a toast notification before app is deactivated advising the user, and make him navigate back to the app, extending the period for other 4 hours that way.
There is no way to keep it running without any user interaction.

Alternative for Background Transfer Service to run uploads in background

I've used background transfer service (BTS) API for Windows Phone in two apps and experienced very bad problems. It became one of the main source of bug in the two apps as for some reasons, download are often refusing to start, whatever I set in the flags (Connected to wifi, not connected, connected to a power outlet, etc.), and it was random from a user to another. This and bad response from the servers.
Is there a more customized way to achieve it? Which threads or loop remains alive in my app when I'm navigating to the external:// world? I should probably check with counters.
My main question remains: appart from the BTS, is there something to allow a 3-4 megs file to upload even if I navigate out from my app to play an mp3 from an external:// app?
Once you exit your app, you are pretty much shut down. You can masquerade as a location tracking background agent to remain in the background when you get deactivated, though you'll suck battery and I believe there can only be one of these active at a time. Generally, highly not recommended (and you'll probably fail certification).
A better way to do this if BTS is not to your liking is to use a ResourceIntensiveTask. This will only be triggered when the user is plugged in and has WiFi but will allow you to run whatever you want for as long as the conditions are met (for example, at night) which should be plenty of time to upload a 3-4 MB file.

Prevent stealing HTML5 video in the browser?

I'm looking for a way to securely deliver video to mobile devices. There are two options:
HLS in tag. This works very nicely for iOS and supports adaptive bitrate, perfect for mobile. However, is seems to only work well on iOS. There seems to be only fragmented support for it on Android. I've read that Android has officially supported it since 3.0, but on all the android devices I've tested (>3.0), HLS hasn't played back on the browser.
Progressive download in tag. This will work on iOS and Android devices fine, but the concern is that since it's just a progressive download of the video, that the user find a way to just grab that video once the browser has finished downloading it. This may be more difficult on iOS, but I'm sure it's not that hard to figure out where the browser stored the video download in a tmp folder somewhere.
Either method I'd say can be protected from deeplinking by using an expiring token approach, where the token is generated serverside with a secret key that only the content server knows about. The video request would only be valid for 5 or 10 minutes, would would kill of deeplinking.
Is anyone aware of any way around these issues? Even if I was able to prevent deeplinking, the user could still get the video itself and re-distribute. Perhaps it's just not possible?
Thanks
Rule #1 of the internet:
If you don't want someone stealing it, don't put it online.
Welcome to the circumvention arms race. Brought to you by DownloadHelper.
There's nothing you can do to stop someone who really wants to pirate your video. There are various measures, like those you mention, that make it more difficult, but someone who really wants to copy it could find a way to capture it from memory, or even just point a camera at the screen and record the playback of the video.
It's the same way you protect your car. You install a steering lock, an alarm and an engine immobiliser, and then someone comes alongs and pulls the car onto a flat-bed truck and drives away with it.
Bottom line - you can't stop a determined thief, but you can make theft more difficult so that you're not the most attractive target.
As I was reading the above I could easily get pass all these techniques pretty quickly.
For a project I can't describe too much because of nda, we created our own protocol based on a well known encryption method can't mention that either , military grade) , encoded packets on the server to the protocol, and decoded on the device.
unfortunately this isn't perfect either because a lot of mobile apps can be re-versed engineered and once you get the key game over, very easy on android, of course you could periodically recycle the key, in which case even if they decompiled the android app and got the key it wouldn't work very long.
This is a lot of work and can't be implemented with html5 or hLS or event rtsp.
It also requires a custom server application that takes the video stream re-transmits it with the custom protocol.
On the other hand the protocol was transport agnostic, which meant we could use a variety of transports, tcp, IAP and bluetooth. Also would work on all mobile / desktop platforms.
The other little requirement, is couldn't use a browser, have to be a custom app.