我可以在我的Android应用程序中禁用systemui吗? [英] Can I disable systemui From within my android app?
本文介绍了我可以在我的Android应用程序中禁用systemui吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下答案为我的应用实现了Kiosk模式: https://stackoverflow.com/a/26013850
I used this answer to achieve a Kiosk Mode for my app: https://stackoverflow.com/a/26013850
我将平板电脑的Kingo Root植根,然后执行以下命令:
I rooted the tablet with Kingo Root and then performed the following commands:
adb shell >
su >
pm disable com.android.systemui >
我正在构建一个仅可在我们的设备上用作信息亭的应用程序.
I am building an app that will only be used on our devices as kiosks....
它的效果很好,但我想从Android应用程序本身执行系统ui的禁用和启用.
It works great BUT.. I would like to perform the disable and enable of the system ui from the Android application itself.
在应用程序中是否可以使用系统命令?
Are system commands possible from within an application?
推荐答案
/**
* Uses Root access to enable and disable SystemUI.
* @param enabled Decide whether to enable or disable.
*/
public void setSystemUIEnabled(boolean enabled){
try {
Process p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("pm " + (enabled ? "enable" : "disable")
+ " com.android.systemui\n");
os.writeBytes("exit\n");
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
工作正常.用法:
setSystemUIEnabled(true); // Enable SystemUI
setSystemUIEnabled(false); // Disable SystemUI
这篇关于我可以在我的Android应用程序中禁用systemui吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文