简体   繁体   English

我该如何锁定我的应用程序,以使其无法从最近的屏幕中删除

[英]How can I put a lock on my app so It can't be removed from recent screens

I want to put a lock icon to my app. 我想在我的应用中添加一个锁定图标。 How can I do that programmatically as in some social apps like in the following picture? 如下面的图片所示,我该如何以编程方式做到这一点? I want to prevent the user from clearing my app from recent screens or task as it's using services in the background and Oppo, Mi and Lenovo kills it. 我想防止用户从最近的屏幕或任务中清除我的应用程序,因为它在后台使用服务,而Oppo,Mi和Lenovo则将其杀死。 I already tried it but it didn't work for me 我已经尝试过了,但是对我没有用

startLockTask();

在此处输入图片说明

Firstly, that lock is not implemented by Whatsapp or any other social networking site. 首先,Whatsapp或任何其他社交网站未实现该锁定。 That lock is set by the user manually. 该锁定由用户手动设置。

And what does that Lock do is whenever the user clears RAM, then all the applications that are locked will not be killed if that (app) is either in the foreground or background. 而且Lock的作用是,每当用户清除RAM时,如果那个(应用程序)位于前台或后台,则所有被锁定的应用程序都不会被杀死。 So that's nothing to do with the code of that particular app. 因此,与该特定应用程序的代码无关。

Now, quoting this line: I want user to prevent from clearing my app from recent screens . 现在,引用此行: 我希望用户防止从最近的屏幕上清除我的应用程序

Users can still clear any of the locked apps manually. 用户仍然可以手动清除任何锁定的应用程序。 That means if they swipe any locked app, then that app will be cleared. 这意味着,如果他们滑动任何锁定的应用程序,则该应用程序将被清除。 That lock only prevents the clearing of app when the user taps on clear RAM. 该锁定仅在用户点击清除RAM时阻止清除应用程序。

All in all, You can't set that kind of lock programmatically in any of your apps. 总而言之,您无法在任何应用中以编程方式设置这种锁定。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使应用程序被杀死,我怎样才能让我的应用程序运行? 从最近的应用程序中删除时在某种意义上被杀死 - How can i make my app run even when app is killed? killed in the sense when it is removed from recent apps 如何设置安全性,以便我的服务器只接受来自我的应用程序的请求 - How can I put in security so that my server only accepts requests coming from my app 如何在我的应用程序上进行会话,以便在关闭应用程序后无需再次登录? - how can i put session on my app so that i don't need to login again after closing the app? 我怎么知道我的应用程序已被删除? - How can I know if my app is removed? 如果Android重新启动我的应用程序,如何确定它不会加载最新片段? - If Android restarts my app, how can I make sure it doesn't load the most recent fragment? 如何检测从最近列表中删除的应用程序? - How to detect app removed from the recent list? 锁定屏幕后如何使我的应用正常工作? - How can I make my app work after lock screen? 如何在我的应用程序中使用锁定屏幕 - How can i use the lock screen in my app 如何隐藏我的API密钥,以便任何人反编译我的应用程序都看不到它? - How can I make my API key hidden so that anyone decompling my app wouldn't see it? 按返回键无法完成我的应用。 但是将其从最近的应用列表中删除可以 - Press back key can't finish my app. But removing it from recent apps list can
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM