HOME键不起作用,可以收听吗?

发布于 2024-11-27 06:54:31 字数 470 浏览 3 评论 0原文

好吧,这是我的问题。 每当我按下 HOME 按钮时,什么也没有发生。 如果我在应用程序中并按下它,我不会像我应该的那样被发送到主屏幕。

但是,如果屏幕被锁定并且我按下它屏幕会亮起(因为按下了一个键)。

因此,据我所知,系统正在注册 HOME 按键,但没有调用“android.intent.category.HOME”意图。

有没有某种方法可以监视 HOME 按钮,并且如果按下该按钮,则从我的应用程序中调用“android.intent.category.HOME”意图? 我查遍了 StackOverflow,但是当 HOME 意图未激活时,我找不到任何侦听 HOME 键的工作方法。

问题回顾:

按下 HOME 按钮会导致系统在锁定时唤醒,因此该键显然可以工作。

HOME 按钮不会导致“android.intent.category.HOME”意图激活,也不会发送所有打开的应用程序背景。

有什么帮助吗?

Ok here's my problem.
Whenever I press the HOME button nothing happens.
If i'm in an app and press it i'm not sent to the home screen like I should be.

However, if the screen is locked and i press it the screen will light up(because a key was pressed).

So from what i can tell, the system is registering the keypress for HOME but is not calling the "android.intent.category.HOME" intent.

Is there some way to monitor the HOME button, and if it's pressed call the "android.intent.category.HOME" intent from my app?
I've looked all over StackOverflow, but I can't find any working way to listen for the HOME key when the HOME intent doesn't activate.

Review of issue:

HOME button press causes the system to wake up when locked, so the key obviously works..

HOME button will not cause the "android.intent.category.HOME" intent to activate, nor will it send all open apps to the background.

Any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

格子衫的從容 2024-12-04 06:54:31

我的 TF101 上遇到了这个问题,我想我用 Titanium Backup 删除了一些 Android 设置。重新启动设备后,主页按钮不会执行任何操作,一些快速设置不会显示,电源按钮将显示很少的选项。

很多网站提示我恢复出厂设置(备份和恢复需要一天)。在尝试了几种可能的解决方案后,我想到了这个线程 http:// forum.cyanogenmod.org/topic/19605-home-button-issues-striking-back/ 解决了这个问题。

我使用安装在 Ubuntu 上的 android sdk,使用以下步骤:

  1. 使用 adb as su 检索 android 设置数据库:

    sudo platform-tools/adb -d pull /data/data/com.android.providers.settings/databases/settings.db settings.db

  2. 使用 sqlite3 检查 device_provisioned =1(缺少此设置)

    tools/sqlite3 settings.db“从安全中选择*;” | grep 规定

正确答案是“nnn|device_provisioned|1”,其中 nnn 是行号。如果没有答案,您必须将此设置添加到文件中。

  1. 使用 sqlite3 将此设置添加到文件中

    tools/sqlite3 settings.db“插入安全(名称,值)值('device_provisioned','1');”

  2. 将文件放回您的 Android 设备

    sudo platform-tools/adb -d Push settings.db /data/data/com.android.providers.settings/databases/settings.db

  3. 关闭 android 电源(首先我尝试了电源按钮菜单上的重新启动选项,但它以某种方式恢复了我的错误设置,然后我按下电源按钮直到设备自行关闭。)

  4. 开机。 “主页”按钮再次可用(以及其他缺失的功能)。

I had this problem on my TF101, I think I erased some android settings with Titanium Backup. After I rebooted the device, Home button would do nothing, some quick settings would not show up and power button would show very few options.

A lot of sites prompted me to do a factory reset (backup and restore would take a day). After trying several possible solutions I came about this thread http://forum.cyanogenmod.org/topic/19605-home-button-issues-striking-back/ that solved it.

I used the android sdk installed on my Ubuntu, using the following steps:

  1. Use adb as su to retrieve the android settings database:

    sudo platform-tools/adb -d pull /data/data/com.android.providers.settings/databases/settings.db settings.db

  2. Use sqlite3 to check if device_provisioned=1 (this setting was missing)

    tools/sqlite3 settings.db "select * from secure;" | grep provision

correct answer would be "nnn|device_provisioned|1" where nnn is the number of the line. If there was no answer, you would have to add this setting to the file.

  1. Use sqlite3 to add this setting to the file

    tools/sqlite3 settings.db "INSERT INTO secure (name,value) VALUES ('device_provisioned','1');"

  2. Put the file back on your android device

    sudo platform-tools/adb -d push settings.db /data/data/com.android.providers.settings/databases/settings.db

  3. Power down android (at first I tried the reboot option on the power button menu, but it restored my faulty settings somehow. Afterwards I pressed the power button until the device shut itself down.)

  4. Power on. The Home button was working again (along with the other missing features).

就此别过 2024-12-04 06:54:31

但是,如果屏幕被锁定并且我按下它,屏幕就会亮起(因为按下了一个键)。

正如其他人评论的那样,这不是正常的 Android 设备行为。也许这对于您的手机型号来说是正常的,在这种情况下,我很遗憾听到这个消息,因为您的电池寿命可能会很糟糕,因为您将永远按下 HOME 按钮并打开屏幕。

是否有某种方法可以监视 HOME 按钮,并在按下该按钮时从我的应用程序中调用“android.intent.category.HOME”意图?

不。您可以编写一个实现主屏幕的活动,但这似乎不太可能对您有帮助。

有什么帮助吗?

最有可能的是,您的设备上有一些应用程序是您的默认主屏幕,并且行为异常。尝试查找并卸载它。或者,在安全模式下重新启动手机,看看是否可以恢复控制权,以便您可以找到并卸载它。或者,将手机恢复出厂设置。

有关此主题的进一步讨论,请访问 http://android.stackexchange.com,Android 最终用户问题之家。

However, if the screen is locked and i press it the screen will light up(because a key was pressed).

This is not normal Android device behavior, as others have commented. Perhaps it is normal for your model of phone, in which case, I'm sorry to hear that, as your battery life is likely to suck, since you will be forever bumping the HOME button and turning on the screen.

Is there some way to monitor the HOME button, and if it's pressed call the "android.intent.category.HOME" intent from my app?

No. You can write an activity that implements a home screen, but that seems unlikely to help you here.

Any help?

Most likely, you have some app on your device that is your default home screen and is misbehaving. Try to find and uninstall it. Or, reboot your phone in safe mode and see if that gives you control back so you can find and uninstall it. Or, factory-reset your phone.

For further discussion on this topic, please visit http://android.stackexchange.com, the home for Android end-user questions.

七秒鱼° 2024-12-04 06:54:31

对于仍在寻找此问题的人来说,我的设备的主页按钮在崩溃后被禁用。我尝试了一切,包括重新启动。还有一些其他功能问题。

|||当我接到并接听电话后,问题就以某种方式解决了。|||

也许某个服务因意外而被禁用,并且电话重新启动了它,但希望这可以帮助任何因此问题而感到沮丧的人。

For anyone searching for this problem still, my device's home button was disabled after a crash. I tried everything, including a reboot. There were also some other functional problems as well.

|||Once I received and answered a phone call, the problem was fixed somehow.|||

Maybe a service was disabled on accident and telephony restarted it, but hopefully this helps anyone frustrated by this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文