0

我创建了一个应用程序,使用 flash LED android 作为手电筒或闪光灯,并添加了唤醒锁和电源管理器以防止睡眠。但是当用户进入菜单设置时,我的 apk 崩溃了。没有唤醒锁可以正常工作!我如何修复它?

private PowerManager.WakeLock wl;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "Flash Strobe");

        // .......................
        case R.id.menu_setup:
            stopTask();//stop timer repeat blink
            if (camera != null) {
                camera.release();
            } 
            wl.release();
            finish();
            startActivity(new Intent(this, Setup.class));
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }

日志猫:

W/ServiceManager(148): Permission failure: com.sonyericsson.permission.CAMERA_EXTENDED from uid=10151 pid=24623
f_button_handler button callback not registered
4

0 回答 0