应用程序因唤醒锁定和电源管理器崩溃

时间:2013-02-01 14:24:31

标签: android wakelock

我创建了一个应用程序,使用闪光LED安卓作为火炬或频闪灯,并添加唤醒锁和电源管理器,以便不睡觉。但是,当用户进入菜单设置我的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);
        }

logcat的:

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

0 个答案:

没有答案