Hi to all,
I have read a lot of threads on this forum for kiosk apps on tablets. Below you will find the way to make kiosk apps.
1)You will need to have a root tablet pc.
2)Go on /system/usr/keylayout folder and change the hardkeys key codes.
Below, you will find an example :
key 59 BACK
key 102 BACK
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 BACK
key 143 BACK
key 158 BACK
key 212 BACK
key 217 BACK
As you seen, I have changed everything to Back and the reason is simple. If the user press any hard button, from your code you can control the Back button through the following code :
With the above code, when the user press any key, nothing will happen.
3)Then, set the activity attributes as:
4)On the Manifest editor, add the following code and add your application as the main Laucher when you run your application for 1st time.
5) On the activity_create add the following code:
The status bar disappeared !!!! the user cannot exist from the application. Be carefull ... not to lock your tablet !!!!
Have a fun ......
Antonis
I have read a lot of threads on this forum for kiosk apps on tablets. Below you will find the way to make kiosk apps.
1)You will need to have a root tablet pc.
2)Go on /system/usr/keylayout folder and change the hardkeys key codes.
Below, you will find an example :
key 59 BACK
key 102 BACK
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 BACK
key 143 BACK
key 158 BACK
key 212 BACK
key 217 BACK
As you seen, I have changed everything to Back and the reason is simple. If the user press any hard button, from your code you can control the Back button through the following code :
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
Return True
End If
End Sub
With the above code, when the user press any key, nothing will happen.
3)Then, set the activity attributes as:
B4X:
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
4)On the Manifest editor, add the following code and add your application as the main Laucher when you run your application for 1st time.
B4X:
'Kiosk Mode
AddActivityText("main",
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/>
</intent-filter>
)
AddPermission(android.permission.STATUS_BAR)
5) On the activity_create add the following code:
B4X:
Dim r As Reflector
r.Target=Activity
r.RunMethod2("setSystemUiVisibility", 8, "java.lang.int")
The status bar disappeared !!!! the user cannot exist from the application. Be carefull ... not to lock your tablet !!!!
Have a fun ......
Antonis