gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 05:58:26 26 4
gpt4 key购买 nike

我正在为 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com