且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Kiosk模式为Android

更新时间:2023-10-22 20:28:46

我做了很多的研究,现在终于让我很满意我得到了什么。

I did a lot of research and now finally I am satisfied with what I got.

您基本上有两种选择:

  1. 创建你自己定制ROM,这是不是对我***的解决方案。

  1. Create you own custom ROM, which is not the best solution for me.

自定义使用各种黑客的牌位。

Customize the tablets using various hacks.

所以,我将解释第二个选项。

So I will be explaining the second option.

首先,你需要以root您的设备。有多种方法,但我preFER通过一键式软件生根。对于中国平板电脑,您可以使用虚拟根和较受欢迎的使用金吾根。

First you need to root your devices. There are various methods, but I prefer rooting by oneclick software. For Chinese tablets you can use VROOT and for more popular ones use Kingo root.

现在,你有你的设备扎根,我们可以摆脱顶部和底部的吧。

Now, that you have your device rooted, we can get rid of the top and bottom bar.

private void hideBar(){
    try
    {
        Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 42 s16 com.android.systemui"}); 
        proc.waitFor();
    }
    catch(Exception ex)
    {
        Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
        Log.e("ROOT ERROR", ex.getMessage());
    }
}

这将使得顶部和底部栏消失。然而,你可能需要一种方法来再次显示了吧。对于您可以使用:

This will make the top and bottom bar disappear. However you will probably need a way to show the bars again. For that you can use:

public void showBars(){
    try 
    {
        String command;
        command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib am startservice -n com.android.systemui/.SystemUIService";
        String[] envp = null;
        Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
        proc.waitFor();
    } 
    catch(Exception ex)
    {
        Toast.makeText(context.getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
    }
}

确定,所以我们有,剩下的工作就是让你的应用程序在启动时启动。 对于,你可以找到很多教程,只是谷歌。

Ok so we have that, all that remains is to make your application start at boot time. For that you can find many tutorials, just google.