android - 不修改框架,有没有方法禁止一个 Activity 关闭?
PHPz
PHPz 2017-04-17 17:11:09
0
6
413

如题。我不是要做流氓软件,确实有这么一个需求,设备一台特制的工业用平板电脑,操作系统是一修改过的 Android,但是厂商没有提供框架源代码。要求是 app 在手机上打开时允许关闭,在工业平板上打开时不允许关闭,并且平板上只有我们这个项目这一个 app,最好能开机自启动,app 占满屏幕。

PHPz
PHPz

学习是最好的投资!

reply all(6)
Ty80

When you turn it off, do you mean pressing the back button or the Home button? The back push button can be handled by overriding OnBackPress, but there is nothing you can do about the Home button.

黄舟

Be a launcher
Block Activity onkeydown

Peter_Zhu

I feel like you are still a beginner on Android. The startup and full-screen display you mentioned are functions already provided by the system. I think you will know this from Baidu.
In addition, the closing of Activity is controlled by the App itself, not to mention that you have already started it and displayed it in full screen. As long as you don’t close it yourself, users naturally cannot open other applications to close it.

伊谢尔伦

Intercept back event

黄舟

It can be achieved using hook technology, but the phone needs root permissions

刘奇

I had an idea before - startActivity itself during onPause. Facts have proved - this is really a deadlock! Unless you kill the process directly, you will not be able to exit whether it is home or back

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template