java - 在 android 中处理最近的应用程序点击和主页按下

标签 java android security android-manifest

我正在为 children 制作一个应用程序,一旦您进入该应用程序,如果没有我在菜单中要求的密码,您将无法退出。现在我想如果在应用程序内我按下应用程序中的主页按钮它应该保持相同的 Activity 。我搜索了很多,但解决方案到处都是在 list 中添加过滤器,但这些对我来说效果不佳。我希望在应用程序退出时从启动器中删除我的 Activity ,并再次询问是否启动应用程序。

对于同一个应用程序,如果我按下最近使用的应用程序按钮并且其中一个被 child 点击,则该应用程序也应该处于相同的 Activity 中,或者是否有任何方法可以阻止最近使用的应用程序按钮。

我试过了

<activity
    android:label="@string/app_name"
    android:launchMode="singleInstance"
    android:name=".MyActivity"
    android:screenOrientation="landscape"
    android:excludeFromRecents="true"
    android:taskAffinity=""
    android:stateNotNeeded="true" >
    <intent-filter >
        <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.HOME" />
         <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

最佳答案

I am making an app for kids where once you inside the app can't exit without password which i am asking in menu.

幸运的是,出于明显的安全原因,这是不可能的。

Now i want if inside app i press home button in the app it should remain on same activity, i searched a lot but everywhere the solution is adding filters in manifest but those are not working well for me.

“对我来说效果不佳”是对您的症状的完全无用的解释。您的 SDK 中有一个 Home 示例应用程序,用于演示如何设置主屏幕。

And for the same app if i press recent app button and one of those is clicked by the kid also the app should be in same activity or if there any way to block the recent app button.

这两个都不可能。

如果您想制作一款单一用途的 Android 设备,您需要在固件级别进行。

关于java - 在 android 中处理最近的应用程序点击和主页按下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11120176/

相关文章:

java - 加密Android代码?

Java客户端/服务器多线程文件传输问题

java - Spring jpa存储库查找全部

java - java从txt文件中检索特定字符串

security - Nginx 从代理服务器中删除 Cookie 的安全标志

security - 为什么 FormsAuthentication 的 requireSSL 属性默认为 false!

security - 围绕ENTRYPOINT的Docker安全性问题

java - 如何在 freemarker 中自定义数字格式?

android - key 轮换后,我是否仍然需要旧 key 来签署应用程序的更新?

java - jsch sftp - 更改到父目录