如何拦截pssed在服务硬键$ P $?pssed

由网友(ー颗心只容ー个人)分享简介:反正是有拦截硬键被以推出一项活动使用服务pssed $ P $?Is there anyway to intercept that a hard key was pressed by using a service in order to launch an activity?在换句话说:是否可以处理的KeyEve...

反正是有拦截硬键被以推出一项活动使用服务pssed $ P $?

Is there anyway to intercept that a hard key was pressed by using a service in order to launch an activity?

在换句话说:是否可以处理的KeyEvent在服务

In other words : Is it possible to handle the KeyEvents in the Service?

推荐答案

有监听硬件密钥从任何的关键事件,除了当前活动的应用程序没有一般的方法。

There is no general way to listen for the key events of the hardware keys from anything besides the currently active application.

只有CAMERA按键事件可以被检测到,通过其广播意图

Only the CAMERA button event can be detected, via its broadcast Intent.

的ACTION_CAMERA_BUTTON被广播时,摄像机按钮pressed并且不被前台活动截获: developer.android.com/reference/android/content/...

The ACTION_CAMERA_BUTTON is broadcast when the CAMERA button is pressed and is not intercepted by the foreground activity: developer.android.com/reference/android/content/…

这意味着你只能探测到preSS如果在前台应用程序不处理的关键preSS。

This means you can only detect the press if the application in the foreground is not handling the key press.

阅读全文

相关推荐

最新文章