小编ste*_*ker的帖子

Android:屏幕关闭后保持相机LED亮起

因为我刚开始使用Android编码,所以我犹豫是否发布了我的问题,但现在我正处于无法抗拒的地步.

我有一项服务打开摄像头LED onCreate:

@Override
public void onCreate() {
// make sure we don't sleep
this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SleepLED");

    this.mTimer = new Timer();
    this.mTimerTask = new TimerTask() {
        public void run() {
        // turn on the LED
        setFlashlight(Camera.Parameters.FLASH_MODE_TORCH);

        mWakeLock.acquire();
        }
    };

    // Get the notification-service
    this.mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    // Display a notification about us starting.  We put an icon in the status bar.
    showNotification();

    // Open camera
    this.frontCam = Camera.open();
    this.frontCamPara = frontCam.getParameters();
    this.frontCam.lock();


    // Schedule the …
Run Code Online (Sandbox Code Playgroud)

camera android led wakelock flashlight

6
推荐指数
1
解决办法
6930
查看次数

标签 统计

android ×1

camera ×1

flashlight ×1

led ×1

wakelock ×1