20

Note : I don't want to submit this app to app store.

What i want to achieve :

I want simple app with one view having two button Lock and Unlock.

Lock - This button will lock device. Only this app's screen will show nothing else will be accessible even after restart same screen will show up. Home button, gestures will get disabled similar to single app mode.

Unlock - This will unlock device and switch to normal behaviour of device.

iOS : I want this for iOS 4.3 and above.

I have checked following solutions, but these don't match my requirements

  1. Configuration profile

    Lock-down iPhone/iPod/iPad so it can only run one app

    But it is manual (reboot device, open app which you want to run in single app mode). I want to do it programmatically the way i mentioned above through my app.

  2. Guided access (iOS 6 and above)

    How to lock down user to Single App mode in iOS 6, Programmatically?

    I want it do for all os and programatically.

Is there any way to do this ? As i don't wan't to submit it to app store is there any private api, some hack for springboard to achieve this ?

Thanks in advance !!

Community
  • 1
  • 1
Aditya Deshmane
  • 4,676
  • 2
  • 29
  • 35

3 Answers3

23

As I know in iOS 7 there is a new feature which allow to do exactly what you want. However, it's only applicable for iOS 7 (and I believe it's only applicable to a supervised devices).

1) You will need to install restriction configuration profile with autonomousSingleAppModePermittedAppIDs key (take a look here)

This is one time step and a user will need to manually accept this configuration profile.

There is another option to use MDM to install it silently, but it could be an overkill for you.

2) You should use API:

UIAccessibilityRequestGuidedAccessSession (to lock/unlock)

It is defined here

3) And most beautility part. All of it is officially document. So, you can even submit it to AppStore.

P.S. Why do you care about 4.3 or 5? They have tiny market share by now. Most likely even iOS 6 has below 20% market share already.

Update 1

Potentially, you can try to use API which sends clicks and keys (search for GSEvent in iPhone-privateapi tag). May be using these API's you can do triple home to toggle accessibility on and off.

If this work, I think you should be able to cover iOS 6. I am not sure whether both this API and triple home click were available prior that.

It looks like this private API is unaccessible anymore in iOS 7. So, probably you can ignore this idea.

Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
  • Thanks !!! i didn't knew guided access has api too.. Yes iOS 7 has major market share, but there are some apps whose minimum iOS requirement is 4.3 etc, so i can't upgrade all of them. Those devices are just kept like that for sake of testing and for app support. – Aditya Deshmane Dec 02 '13 at 08:22
  • 1
    autonomousSingleAppModePermittedAppIDs requires the device to be supervised, which as far as I can tell requires the device to have been physically setup with Apple Configurator, and won't allow the device to sync with any other machine. Is there any way around this? – Ben Dowling Dec 18 '13 at 05:48
  • @BenDowling: It's interesting information. I missed this piece of information that it was for supervised mode only. – Victor Ronin Dec 18 '13 at 15:41
  • How, if at all, would one exit an app that has been set up this way? – Dan F Jan 28 '14 at 21:12
  • @DanF: That depends. In some case, user shouldn't exit at all. That's the whole point. As example, when you have a kiosk or iPad with some app which you use when you enter the store. Some apps, which use UIAccessibilityRequestGuidedAccessSession may allow you to enter some password to unlock them and exit to Home screen. – Victor Ronin Jan 29 '14 at 00:16
  • @VictorRonin, I tried using the old `GSEvent` technique to simulate a home button click (single, double, triple) and it no longer appears to work, in iOS 7. – Nate Mar 11 '14 at 01:43
  • @Nate: Yeah. That's true. I didn't know about problems with GSEvent at that moment. I will updated my answer now. – Victor Ronin Mar 11 '14 at 05:10
  • 1
    @VictorRonin I don't think step 1+2 is 100% accurate. From docs [UIAccessibilityIsGuidedAccessEnabled](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIAccessibilityIsGuidedAccessEnabled) `...Entering Single App mode is supported only for devices that are supervised using Mobile Device Management (MDM).. app itself must be enabled .. by MDM.`. That said, I still have [issues] (http://stackoverflow.com/questions/22672486/using-autonomoussingleappmodepermittedappids-and-uiaccessibilityrequestguidedacc) – Sandeep Phadke Mar 26 '14 at 23:24
  • Does this keep the app in single app mode even after restart? – user3413723 Aug 05 '15 at 18:40
  • @user3413723 I am not sure. – Victor Ronin Aug 05 '15 at 19:40
  • @VictorRonin can u please look at my question http://stackoverflow.com/q/40678515/3388012 any guidence ? – Rushi trivedi Nov 19 '16 at 05:28
  • @VictorRonin i want develop app like OurPact. it can be done via regular apple developer account or needed Enterprice account ? what is exactly step for that? please help. – Rushi trivedi Nov 19 '16 at 13:16
  • 1
    @Rushi As I remember you need to register for enterprise developer program, which allows you to become MDM vendor and you will be able to install such configurations through MDM. However, how to write such an app is a topic well beyond StackOverflow. – Victor Ronin Nov 20 '16 at 03:06
  • You do not need an Enterprise Apple Developer account to develop an app with this feature. Requirements: you implement the above function in your code, your customer uses an MDM service to manage their devices, and they have Supervised those devices with said service, and they have allowlisted your bundle ID in their MDM system. https://developer.apple.com/videos/play/wwdc2017/716/?time=771 – evan.bovie Aug 13 '20 at 06:01
3

Just wanted to write on this even though this is old as i needed to implement a similar solution and i got it working. The steps for me as follows and a note here is that this involves MDM and other specific steps.

My requirement was as follows. Each of the iPad at different locations has a set of apps installed.For ease of it lets assume each Dept. has their own apps. Participants open a app related to their dept. to take a test, the APP automatically Locks the iPad to single-app Mode and at the end of the test, it will unlock it self.

  1. Supervise the iPad/iphone using the Apple Configurator.
  2. Install the MDM related files ( Each MDM has its own set of instructions, usually involves downloading a profile).
  3. Every MDM has a option of Single APP Mode or MultipleAppMode. Select the second option and add the app IDs to the list. (A single APP mode works pretty well with MDM's but i did not want the app to be locked to a single APP all the time).
  4. I used the UIAccessibilityRequestGuidedAccessSession api to lock unlock the device from single app mode.

http://bobxcode.blogspot.com/2015/12/programmatically-implement-single-app.html

Thanks, Bob

Bobby
  • 51
  • 4
  • Can you please tell me how to supervise devices programmatically?. Actually, I have to make an app like [Screen Timer](https://screentimelabs.com/) so can you please guide me. – Abhishek Joshi Aug 06 '18 at 13:54
  • For MultipleAppMode, is there a way to disable the sleep/lock button? – Adam Apr 26 '19 at 20:10
1

In MDM configuration, There is an option

  • autonomousSingleAppModePermittedAppIDs

    Optional. Supervised only. If present, allows apps identified by the bundle IDs listed in the array to autonomously enter Single App Mode. Availability: Available only in iOS 7.0 and later.

    But this needs Supervised Device mode.

Sat_Rmd
  • 11
  • 2