MewsSystems / mews-flutter

Flutter and Dart open-source packages maintained by Mews.
58 stars 20 forks source link

Permanently hide Android Bottom Navigation/Statusbar? #552

Open fabioselau077 opened 5 months ago

fabioselau077 commented 5 months ago

Hello, my app will live on an Android tablet for the public, so logically I need to restrict what will be accessed. I need my app to always stay open, I can't exit it and when the device starts, it starts automatically (optional).

I'm using kiosk_mode, but the app is just pinned, if the person clicks on the screen the Android buttons are shown, in which they can hold and unpin the app, as well as pull the statusbar down and turn off the Wi-Fi, access the settings, for example.

Is there any way to do this blocking? In the application I hid a hidden button in which after entering a password, there are some settings, such as battery percentage, wifi settings, button to exit kiosk mode, which when clicked calls the stopKioskMode() function, to be able to exit the application in case of update, configuration...

But the problem is that the normal user can exit the application and use the tablet normally

Any idea? Thanks!

Deepak-GP commented 3 months ago

@fabioselau077 You cannot implement a full scale kiosk mode application in android unless your app has certain privileges - Device Admin app. Either your device needs be rooted to get the device admin privilege or you need to implement the DPC application to get the device admin privilege.

Some of the links that explains about device admin and lock task mode are as below: https://developer.android.com/work/device-admin https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode

And to build your own DPC app you can go through this repo: https://github.com/googlesamples/android-testdpc

There is an app as well which shows how a device policy controller app works in real time. https://play.google.com/store/apps/details?id=com.afwsamples.testdpc

If your devices are rooted, then DPC app is not required. You can directly assign the device admin privilege to your app using su command - dpm set-device-owner yourPackageName And then add the your package to the lock task package list using setLockTaskPackages. (This step is not required when you are using the kiosk_mode flutter package) This will make sure that the home button and app switcher button is hidden in the system UI.