I am currently working on an Android Launcher app for a PAX device.
minSDK: 25
Theme: Theme.Material3.DayNight.NoActionBar
Manifest:
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.ThemeName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I want to make sure that the user won't be able to leave the launcher app.
I tried setting flags on my MainActivity
based on I found on related question: full screen application android
View decorView = getWindow().getDecorView();
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(flags);
I also tried using WindowInsetsController
WindowInsetsControllerCompat windowInsetsController =
WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView());
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
Both is hiding system bars(navigation & status bar), But if you swipe down or up, the system bars will show, I want it to be still hidden.
Do I need to use a specific theme & or manifest configuration to do this? or if not, how can I achieve this.
NOTE: I used a launcher app from our partner that does exactly what I needed. The navigation bar doesn't show, even if I swipe down or up; only the status bar is visible. However, swiping down does not display the quick settings panel.
Using Neptune SDK/PAX SDK
private IDAL iDalService = null;
//Initialize SDK
try {
iDalService = NeptuneLiteUser.getInstance().getDal(this);
} catch (Exception e) {
Log.e("Class Name", "Error initializing Neptune SDK, message: " + e.getMessage());
}
public void hideBars() {
if (iDalService != null) {
//Disable Navigation bar.
iDalService.getSys().enableNavigationBar(false);
//Disable Status bar.
iDalService.getSys().enableStatusBar(false);
//Hide Navigation bar.
iDalService.getSys().showNavigationBar(false);
//Hide Status bar.
iDalService.getSys().enableStatusBar(false);
}
}