Kiosk mode in Android
You can autostart applications on boot by listening to the android.intent.action.BOOT_COMPLETED
intent in a BroadcastReceiver and start your Activity from there. In the Activity you can register yourself as the new default homescreen[1] and handle the keys.
I think there are some instances that you can't handle without modifying the framework (like longpress on Home to show currently active Applications) - I could also be mistaken though.
But for a prototype that could be sufficient.
Have fun tinkering!
[1]:
<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>
Android Kiosk Mode - Allow Exit
You have multiple HOME screens installed (the default one provided by the device manufacturer, and your app). The user must have chosen that your app should be the default HOME screen (this usually happens at boot time). What you now want to do is to remove this "preferred" setting so that the user can choose a different "default" HOME screen (ie: the manufacturer's app). Do that like this:
PackageManager pm = getPackageManager();
pm.clearPackagePreferredActivities ("your.package.name");
and then finish()
your MainActivity
.
EDIT: Alternative solution
As an alternative solution, when you want to "exit" your app, you just launch the default HOME screen instead. To do this, you need to either know the package and class name of the default HOME screen and hardcode that, or you can scan for that info using PackageManager
like this:
PackageManager pm = getPackageManager();
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory(Intent.CATEGORY_HOME);
List<ResolveInfo> infoList = pm.queryIntentActivities(homeIntent, PackageManager.MATCH_DEFAULT_ONLY);
// Scan the list to find the first match that isn't my own app
for (ResolveInfo info : infoList) {
if (!"my.package.name".equals(info.activityInfo.packageName)) {
// This is the first match that isn't my package, so copy the
// package and class names into to the HOME Intent
homeIntent.setClassName(info.activityInfo.packageName,
info.activityInfo.name);
break;
}
}
// Launch the default HOME screen
startActivity(homeIntent);
finish();
In this case, your app is still set as the default HOME screen, so if the user presses the HOME key again, your app will be started. But the user can then "exit" your app to return again to the original HOME screen.
Update Managed Google Play app that is in KIOSK mode
1.
I may be wrong but I had the same problem and it got fixed after I manually updated the app. So in my case I added "appAutoUpdatePolicy": "ALWAYS",
AFTER I made the update, which ended up in my dedicated device not updating my Kiosk App. If you reinstall or manually update your app and then publish any new update AFTER you made the change to your policy, it should work.
2.
I understand that when apps are in Kiosk mode, they cannot simply be updated and that you have to set a time interval where the app is allowed to exit KIOSK mode and update itself. But even though I set the time interval in the policy, it does not update. Even tried to allow the time interval to be the whole day.
If you are refering to:
"systemUpdate":
{
"type": "WINDOWED",
"startMinutes": 0,
"endMinutes": 1439
}
Afaik this is about android system updates and not your Kiosk App.
Related Topics
How to Hide Soft Keyboard on Android After Clicking Outside Edittext
Viewpager.Setoffscreenpagelimit(0) Doesn't Work as Expected
How to Lay Out Views in Relativelayout Programmatically
Android Background Music Service
What Does "Program Type Already Present" Mean
Android- Going Back to Previous Activity with Different Intent Value
Using Intents to Pass Data Between Activities
How to Set Mobile System Time and Date in Android
Android: Reverse Geocoding - Getfromlocation
Android: Create Spinner Programmatically from Array
Runtimeexception: Your Content Must Have a Listview Whose Id Attribute Is 'Android.R.Id.List'
How to Get Apk Signing Signature
How to Read a Text File from the Sd Card in Android
Perform a Task on Uninstall in Android