0

i am having non rooted device. i want to disable BottomNavigationView buttons.i used below codes but none are working.

public void disablebottombars() {
    View decorView = getWindow().getDecorView();
    decorView.setSystemUiVisibility(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);
}

public void FullScreencall() {
    if (Build.VERSION.SDK_INT < 19) {
        View v = this.getWindow().getDecorView();
        v.setSystemUiVisibility(View.GONE);
    } else {
        //for higher api versions.
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        decorView.setSystemUiVisibility(uiOptions);
    }
}
Ratilal Chopda
  • 4,162
  • 4
  • 18
  • 31
  • Any reason why you aren't just [making the app fullscreen](https://stackoverflow.com/questions/26543268/android-making-a-fullscreen-application)? – AesSedai101 Nov 08 '17 at 09:52
  • making app full screen not helps me. i want to disable all bottom and top navigations of default system UI . –  Nov 08 '17 at 10:05
  • 1
    you simply cant, as it is not your permission to disable user's navigation and top bar. If you were able, then you would be able to block the users' devices at some point. This is malware behavior. – Vladyslav Matviienko Nov 08 '17 at 10:07
  • @GajuKrishnan if you own the device, you can set up a [single-purpose device](https://developer.android.com/work/cosu.html). As Vlad mentioned, if your app runs on other devices, you can't do it – AesSedai101 Nov 08 '17 at 10:11
  • @VladMatvienko we have our own devices. what we do is we sell our devices with only our app installed in it. so my requirement is just disable all top and bottomnavigation views so user can not able to access system resources. –  Nov 08 '17 at 10:19
  • 1
    that does not matter on which devices you are going to use your app. It is not possible due to that you may want to install your app on other users' devices, and nobody can let you have such permissions just because you say that you promise to install it only to your specific devices. What you can do about this is to root or create custom rom for that specific devices, and deliver them rooted/with custom rom. – Vladyslav Matviienko Nov 08 '17 at 10:41
  • Also there is a chance that a `kiosk mode` could help you achieve what you want. – Vladyslav Matviienko Nov 08 '17 at 10:42
  • @VladMatvienko How to create custom rom? –  Nov 08 '17 at 10:44
  • This question does not relate to your question. If you have another question - ask another question here. Also don't forget to search before asking. – Vladyslav Matviienko Nov 08 '17 at 10:46

1 Answers1

0

You can look at setting up a Single-purpose device. To do this, your app needs to be set as a device owner, which can be done by invoking adb shell dpm set-device-owner. You can have a look at Google's DPC sample app for full details.

AesSedai101
  • 1,502
  • 2
  • 23
  • 37