赞
踩
熄屏快呼功能网上找了一圈,项目需求有定制物理按键,分别有对应键值,正常情况下是需要应用在前台才能获取键值keycode信息,该方法是放在后台Service动态监听,废话不多说,直接实现。
demo地址: https://download.csdn.net/download/xbj1015892775/11424813
public class RobMoney extends AccessibilityService {
private static final String TAG = "dxj";
private Calendar c = Calendar.getInstance();
int flag=0;
@Override
protected boolean onKeyEvent(KeyEvent event) {
Log.i(TAG, "onKeyEvent");
int key = event.getKeyCode();
System.out.println(key+"..");
switch(key){
case 136://按键对应的keycode值
Intent downintent = new Intent("com.creator.android.KEYCODE_F6_UP");//第一个按键需要监听的广播
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。