How would one take a picture at programmed interval -iOS/iPhone - ios

Seems like this is an often enough asked question. Rather than asking if possible, I'm wondering if there's any potential workarounds.
I understand iPhone background tasks will not allow one to take pictures from a Background Task.
Would there be any other solution to capturing a picture programatically, (1 hr+ intervals) on iOS?
It appears there a variety of potential solutions on Android:
Background services (execute camera function from background)
A wakelock (keeps the App alive at the expense of battery)
Timer (utilize timer to start a service or app)
What would be a potential solution on iOS, or is there actually NO solution for this. Not being an iPhone user myself, are there not any time lapse apps that have the screen turn off??

Related

How much does iOS app size impact app launch latency?

I am guessing an iOS App's size has direct impact on its launch latency, since iOS needs to load the App into memory before launching it. If so, I wonder how much is the impact?
Let's say if I reduce my iOS app from 100M to 80M, how much launch latency improvement I can expect?
Does anyone has experience on this?
Consider that programming a faster App Launch experience is not bound to App Size at all. You could assume even the opposite because in some (i would even say in most) cases coding a faster launch process to start up can (and will) involve more code to make it a very short interaction interrupt experience and so your app size would increase without even delivering more valuable content.
In other words just because you deliver more dynamic or static content does not increase launch time unless you load and instanciate everything you need later on in your app life cycle in UIApplicationDelegate instead of allocating objects at the time of its use.
The same ideals apply to tear down processing (dealloc or saving app state user defaults) if needed. But this experience is usually not seen as a visible interruption of interaction with the device and so often forgotten to be part of the apps life cycle.
You can avoid this prolonged start up experience for users with clever use of LaunchScreen storyboards or similar techniques like partly buffered content for the first seconds. Some apps even take screenshots to be presented at the next start up to make the user feel the last app state is loaded already while building up the real interface.
A common mistake, which you may have seen also very often, is to make use of introduction videos or animations to bridge the time in waiting for the window/view to appear after app launch. So just making use of Launch Screens is never the best solution but a wise decision if the content that needs to be loaded first hand will take a noticeably longer time and can not be avoided.
LaunchScreens are just entertaining/informing about processing and keeping the user engaged while it can be beneficial what you and your app want to represent.
So abbreviated launch time is clearly a design pattern issue and is not bound to app size. Ok, apart from downloading band width if that is needed.

Show advertisement at regular interval of time when iPhone is running

I am working on the app that shows Ads (Video or image) when iPhone is running. If I open any app(eg. Twitter) then also my Ads should be visible at particular interval of time. Is it possible to do so?
No. Your app will not be informed about any other apps being launched. Even if it were, you can't "force-grab" the foreground to display videos. That would totally violate any user interface principle established by iOS.
Besides the technical aspect I'd have my doubts of such an app surviving app review in general, though I don't know the specific part of the TOS right now.
It is possible to show your ads inside your application in intervals or in any pattern you like. However it is not possible to bring your app to foreground when in background to play ads, it is actually not recommended at all. Best thing you can do is set a timer when the app gets in background to send a notification.

How is Cycloramic possible on iOS?

I just came across cycloramic app, which rotates the iPhone automatically to take 360 panoramas (you place the phone upright on a flat surface and it does its magic). I am blown away.
And my question is, how is it possible to control the vibration motor in iOS programmatically? I know you can vibrate it with AudioServices. Is it just straightforward vibration, but interrupted so it has shorter duration? Or is there something in the SDK I'm missing?
And if the app is using internals, how did it make it to App Store?
Any comments welcome
I've been struggling with this last week too. I downloaded Cycloramic and can't imagine how they achieve that effect. In fact, the phone starts with a short vibration and then it continues with a lengthy vibration that makes the phone rotate completely.
The default vibration in the iOS API is:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
and lasts 4 milliseconds with one millisecond of silence. You can try to chain the same function call several times but there will be always an interruption between two calls. I think there is no way to make a lengthy vibration that lasts more than 4 milliseconds :(

iOS - show consistent alert at the top of the UI when backgrounding the app (like personal hotspot does)

I am creating an alarm clock app that requires some user action within the app in order to turn the alarm off. Below is a picture of what another app, Sleep Cycle, does when you turn an alarm on and press the home screen (i.e. background the app).
Here is an image link (I can't post an image yet, no rep despite my many attempts to answer people's questions today) for the effect I want to re-create.
Those that have used iPhone's Personal Hotspot and connected a device will notice that it is the same effect, where a notification appears at the top of the UI - pushing everything down by around 20-40 points. This is highly desirable to an alarm clock app as it encourages the user to keep the app in the foreground so that the app can easily be entered when waking up (instead of relying on the 30 second sound window allowed by local notifications)
Does anyone have any ideas on how to implement this functionality. I assume that it must go somewhere in the:
- (void)applicationDidEnterBackground:(UIApplication *)application
tag within the AppDelegate, but I'm not sure what exactly I need to be reading up on. So if anyone has a link to some relevant Developer Docs that would also be extremely helpful.
Many thanks for your help,
Ryan
There are a handful of built in 'background modes' that change the status bar's appearance depending on what functionality an app provides whilst it's in the background. The one you've identified (a red status bar) is triggered when an app records audio whilst in the background. I presume Sleep Cycle must be acting as though it records audio just for this purpose. Other background modes include VoIP (which I think uses a blue status bar). Check out Apple's documentation on supporting these various background modes
In your case, you'd want to add audio to the UIBackgroundModes property in your Info.plist file.
But note that it wouldn't be unreasonable for Apple to reject an app during review if it pretends to perform one of these background tasks but doesn't. For example, there have been apps in the past that tried playing a silent audio clip continuously in order to stay awake in the background - needless to say Apple got wise to this and the app in question had to change its behaviour.

iOS: Detect screen on/off events

I'm trying to detect screen on/off events from a background service on iOS.
Because my app is not necessarily in the foreground, looking for app lifecycle events such as this aren't any use:
Lock Unlock events iphone
The best solution I've got so far is to search through the system logs, looking for Springboard events. Problem is, it's a pretty expensive operation, and requires regular polling which is a waste of battery. The solution needs to work on non-jailbroken devices but doesn't necessarily need to be app-store approved.
Can anyone suggest something better?

Resources