0
class flashTask extends AsyncTask<Void, Void, Void> {
        public Void doInBackground(Void... voidArr) {
            CallReceiver.this.flashRunnable();
            return null;
        }
    }
void flashRunnable() {
        for (int i = 0; i < this.flashCount; i++) {
            try {
                if (Shared.getInstance().getBooleanValueFromPreference(this.mContext.getString(R.string.pref_call_off_key_broadcast_reciever), false, this.mContext)) {
                    break;
                }
                blinkFlash();
            } catch (Exception unused) {
                Toast.makeText(this.mContext, "Camera is used by another app flash will not Blink", 0).show();
                return;
            }
        }
        CameraManager cameraManager = (CameraManager) this.mContext.getSystemService(Context.CAMERA_SERVICE);
        try {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                cameraManager.setTorchMode(cameraManager.getCameraIdList()[0], false);
            }
        } catch (Exception unused2) {
            throw new RuntimeException(unused2);
        }
    }

I am trying to blink flash light using camera. Camera is not used by another app flash will not Blink

Caused by android.os.ServiceSpecificException setTorchMode:1532: Camera "0" does not have a flash unit

0 Answers0