We have a program that we install on the phones and loan the phones to users for a certain period. We would like the phones to be used solely for running our application (no phone calls, no games, no nothing). The phones will be rooted.
So the things we need:
- Run in full screen, nothing else will be visible
- Home button and other device buttons won't work
- Our app will run automatically on startup
It doesn't have to be "hacker proof", but should be sufficient to prevent average user messing with the device.
Is this possible? I have done similar things on Symbian & Windows Mobile but I don't have much experience with this stuff on Android. How may this be achieved?
UPDATE 2015: If you don't mind limiting your app to single phone vendor, Samsung has introduced the KNOX SDK that lets you achieve kiosk mode and much more easily without rooting the phone. See details at: https://seap.samsung.com/developer/sdk/knox-standard-android
Vineet's solution works. However i think it requires two more permissions that i found out from here
So the permissions needed are
Although it worked for me like this
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
Yes it is possible but you can not control the behaviour of
Home key
andend call key
.for full screen add
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
to activity tag in manifest file.To disable incoming call you need to listen phone calls:
Note: While stopping service don't foget to remove the listener and add these permissions to your manifest file:
and disconnect the call programmatically:
Note: Add this file to disconnect the call: http://dl.dropbox.com/u/31740476/ITelephony.aidl
To disable keys you need to override:
On Home key press the Home screen will come, so to overcome this you need to implement a service and there you need to implement a infinite thread to relaunch your app like this:
EDIT
You would need to add the following permission to be able to end calls:
And you can use the following AIDL file:
you can also have a look into this: https://github.com/ligi/Setec-Astronomy sorry for the shame-less self-plug but we have simmilar problems there ;-)
@Vineet Shukla: The
READ_PHONE_STATE
permission isn't enough to make it work. You also need theCALL_PHONE
permission to end the call.The
MODIFY_PHONE_STATE
(as said by Zaki Choudhury) is a system permission and can be used only on rooted devices and is not needed by any part of the code.