Is there a way to make my app the only running app in a device, what I mean is the only visible and open app? Once the device booted, the app will launch automatically while any tap to settings at status bar, back, home and recent apps button are disabled. Probably a custom Android OS is required or rooting the device will be enough? We plan to have a set of devices where users can only operate with one app. Thanks
Asked
Active
Viewed 1,234 times
0
-
1https://developer.android.com/work/dpc/dedicated-devices – CommonsWare Sep 28 '22 at 19:50
-
This might help.. https://stackoverflow.com/questions/12074980/bring-application-to-front-after-user-clicks-on-home-button – Immanuel Oct 04 '22 at 05:28
1 Answers
2
You need to be able to remove current launcher app to the system part of the device.
Then it's as simple as:
- Adding
android:launchMode="singleTask"
to activity tag inAndroidManifest.xml
- Adding
<category android:name="android.intent.category.DEFAULT" />
and<category android:name="android.intent.category.HOME" />
to your intent filter
The end result should look similar to this:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.app.MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>

Lukáš Anda
- 560
- 1
- 5
- 23
-
-
If you don't have any other android app installed, the device will use this one. And if the user taps on home button, it won't be exited I believe. Give it a go and you'll see :) – Lukáš Anda Sep 29 '22 at 13:37
-
-
Not if you make it a system app and prevent user from doing so. Basically the same way you can replace default Android launcher app, somebody can do the same to your launcher app. – Lukáš Anda Sep 29 '22 at 14:56
-
-
I don't think I understand. If you set your app as the launcher app, it will function the exact way as app launcher does on Android. You can for example show other apps, you can do custom widgets and whatnot, depends on your needs. But the user can't quit your app when it's set as a launcher – Lukáš Anda Sep 29 '22 at 19:25
-
Is there a way to treat it as system app or rooting the device is the only easiest way? – Bitwise DEVS Sep 30 '22 at 01:23
-
It is the only way. Without rooting, you can't put an app to system folder. – Lukáš Anda Sep 30 '22 at 07:47
-
@BitwiseDEVS if you are happy with the answer, please mark it as accepted – Lukáš Anda Oct 04 '22 at 14:28