3

I want to build an app for android and ensure that the user can only use this app. (i.e. user should not be able to open or install any other app.)

Is it possible to force such restrictions on an Android device ? And if it is where should I start ?

CJBS
  • 15,147
  • 6
  • 86
  • 135
Laith Mihyar
  • 891
  • 7
  • 7
  • Do you mean that you want to create an App that will "lock down" certain functions of an Android device? Sort of like a "guest" login on another operating system? – Michael Todd Oct 14 '14 at 22:47
  • yeah exactly lock down all apps with new permissions to end user yeah yeah – Laith Mihyar Oct 14 '14 at 22:48
  • Just to be sure I understand: you need to develop an app that, after being installed on the device, will block all apps requesting a permission that is not in a kind of "permission-white-list" ? – ben75 Oct 14 '14 at 22:55
  • yeah somehow ! actually i want to build an app to android device only has one application and do not allow to user to open or to install another apps just allow to him use my app – Laith Mihyar Oct 14 '14 at 22:59
  • Related answer: http://stackoverflow.com/a/7121586/3063884 – CJBS Nov 11 '14 at 20:02

2 Answers2

3

What you are looking for is called the "kiosk mode" (just to help you googling the appropriate term).

There is no such thing in the standard android api (at least... not yet : see the Edit). User always have the ability to press the home button to come back to the Home application.

But solutions exists:

  1. Writing an Home app

This solution is a little weak (but may fit your requirements ?) : develop a "Home application" (it's very easy : just put something like this in your manifest :

<activity android:name="MyCustomHome"
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME"/>
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

With this, when the user press the home button : he will have to choose the Home app to use, and if the user decide to make your app it's default Home : he will always came back to your app when pressing the Home button.

Drawback : the Home button is not the only way to get out of the current app, and so this solution won't really block the user (for instance : on samsung, swipe from top to bottom always display the toolbar... and the user can do anything from there)

  1. Using specific constructor extensions :

    • samsung-knox is a solution for recent samsung devices (warning : it's a huge and complex security solution for enterprises : many components to do many things and I think you need to be a samsung partner to get acces to kiosk-mode api)
    • for motorola : there is an app called EnterpriseHomeScreen that can be used to run your own app in kiosk-mode

I guess other solutions exists for other constructors, but I'm not aware of them.


EDIT/UPDATE

With Android-5.0-Lollipop : the screen pinning api allows you to run your app in kiosk-mode. The android terminology for kiosk-mode is screen-pinning-mode.

To make your app working in screen-pinning-mode, you must use Activity.startLockTask (and Activity.stopLockTask() to quit the screen-pinning mode).

By default the user must approve the screen-pinning-mode (a popup will be prompted when your app call startLockTask).

If your app is a device owner : then the user won't be prompted and your can go in screen-pinning-mode without confirmation.

The user can also enable screen-pinning-mode for an app manually by choosing : Settings > Security > Screen Pinning. (in this case: the user can exit screen-pinning-mode by holding both the Back and Recent buttons)

ben75
  • 29,217
  • 10
  • 88
  • 134
  • 1
    Note that the current un-named, un-numbered developer preview contains a task locking API that will finally legitimize kiosk mode. But even when that is officially released, it will be a while before it's available on most devices. – Kevin Krumwiede Oct 14 '14 at 23:23
  • Thank you guys for these awesome details , i got from you that wtv i made the user have the ability to get back to default android home which allow him to use the device as usual, right? – Laith Mihyar Oct 15 '14 at 06:51
  • Yes indeed. But as mentioned by @KevinKrumwiede : a new API (called "Android-Enterprise" I think) will probably be available in future release of the Android API (I don't know the details, but I'm expecting something similar to what is possible with samsung-knox api - i.e. a subset of the whole samsung-knox solution) – ben75 Oct 15 '14 at 08:52
0

Set up Single-Purpose Devices Page of android developer have described this things you can easily get to know more things from there.

Keyur Lakhani
  • 4,321
  • 1
  • 24
  • 35