Changing the behavior of the iOS Lockscreen - ios

Is there a way to change the behavior of the iOS Lockscreen? For instance, can an app, if active, provide a user with dynamic content, such as pictures, as the phone's background, and, in addition, allow a user to swipe left (in addition to swiping right, if they want to unlock the phone) to engage said content?

Is there a way to change the behavior of the iOS Lockscreen?
No.
For instance, can an app, if active...
No.
iOS doesn't provide any API that would allow the sort of thing that you describe. It might be possible to modify or replace the lock screen if you jailbreak your phone -- all bets are off at that point. But an app that uses the Apple-provided API has no way to modify the lock screen.
Also, note that if the device is locked, your app won't be active. You may have intended a looser definition of "active," but looking at the linked chart of app states will help you understand that what you're looking to do isn't achievable with the current API. Apps have to be active to receive events, but a locked phone implies that your app will be in an inactive, background, or suspended state if it's running at all.

No. (Not if you're talking about an 'app' in the sense of the App Store)
The only way an app can interact with the lock screen is through notifications, and cannot alter the standard lock screen interface.
You can alter the lock screen with a MobileSubstrate tweak on a jailbroken phone, but this requires reverse-engineering SpringBoard (the iOS launcher app), can be quite complicated and obviously cannot be distributed through the App Store

Related

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.

iOS - App in Background vs Local Notifcations

I'm building a project which is something like an Alarm Clock app. I know there are inherit limitations here (as compared to the built-in Apple Clock app) but I'm trying to assess if these limitations will be a blocker.
In the end, I need to be able to schedule an alarm/notification at a certain time, and have it sound when the phone is locked. Furthermore, I want to be able to interact with the app from the lock screen (including shake and volume gestures).
Does this require me having the app run in the background, and scheduling LocalNotifications? If its in the background, and the LocalNotification fires on the lock screen, is it possible for the User to interact with the application? i.e. With the app SleepCycle, you can shake the phone from the lock screen to trigger a Snooze. Is that sort of functionality possible only because the app is running in the background (in the case of that app, I know it's running in the background)
yes. you need to be running in the background for interacting on the lock screen

GPS based VS Beacon based ranging? Which governs Lock screen left corner app icon

There are two approaches for showing an app/app suggestion (incase not installed) on the iphone lock screen / app switcher. One is GPS based, in which the IOS decides which app to show as a suggestion. Another is beacon based, in which a particular beacon is identified.
If location services are enabled for multiple apps and say all these apps are also using beacon based approach to show their icons on the lock screen left corner, which app icon will be shown by the IOS?
Since location services are enabled for these apps,and say there is another relevant app which is NOT using beacon based approach (using just the GPS based approach), can IOS give preference to beacon based apps over the GPS based this new app.?
For instance, Estimote’s NYC office is on the same block as an Equinox gym and our phones intelligently and automatically alert us to use that app. It’s super easy and intuitive to open the app while walking into the gym - and in the process, streamline the check-in flow with the gym’s front desk. However, because it solely uses GPS geofences, the accuracy is poor. We actually get the Equinox icon over 1 block away, and there is no control for the brands or stores (in this case Equinox) on how this appears.
Apple's suggestion of apps not installed on the phone based on proximity uses an undocumented technique. While I have verified it uses GPS as an input, I have never been able to confirm that beacons are used at all.
Regardless of whether beacons are used, because this is an undocumented feature, it is unlikely you will find a way to customize the behavior.
AFAIK, Apple has never shared the implementation details of how the lock screen icon AKA "suggested apps" feature works.
However, we did some experiments at Estimote and noticed that being inside a CLRegion (both the "GPS" CLCircularRegion, and CLBeaconRegion work) that an app monitors for via Core Location, consistently makes the app's icon show up on the lock screen. So it seems that both beacons and GPS location fall into the same mechanism that governs the location-based suggestions. (Note that in iOS 9, that's not just the lock screen icon, but also a bar at the bottom of the app switcher.)
Unfortunately, we weren't able to establish what happens if you're inside multiple qualifying CLRegions, belonging to different apps. We suspect it might have something to do with the order in which the apps register regions for monitoring, but were never able to get consistent results.
Furthermore, since this whole behavior is undocumented, Apple can change it at any time. Just something to be aware of.
Side note: handoff always trumps suggested apps.

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