Open pavlomelnyk opened 6 years ago
Ok I see you fixed that at 1.3.4 "/**
@return {@link CameraPreview} that was added to the view. */ private CameraPreview addPreView() { //create fake camera view CameraPreview cameraSourceCameraPreview = new CameraPreview(this, this); cameraSourceCameraPreview.setLayoutParams(new ViewGroup .LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(1, 1,
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ?
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY :
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
mWindowManager.addView(cameraSourceCameraPreview, params);
return cameraSourceCameraPreview;
} "
Thank you this worked me
Hello. Help needed please.
W/System.err: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$WEx@ab0bdc9 -- permission denied for window type 2006 W/System.err: at android.view.ViewRootImpl.setView(ViewRootImpl.java:829) W/System.err: at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:368) W/System.err: at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93) W/System.err: at com.androidhiddencamera.HiddenCameraService.addPreView(HiddenCameraService.java:125) W/System.err: at com.androidhiddencamera.HiddenCameraService.startCamera(HiddenCameraService.java:82) W/System.err: at com.pins.infinity.services.CaptureImageService.onStartCommand(CaptureImageService.java:98) W/System.err: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3609) W/System.err: at android.app.ActivityThread.-wrap20(Unknown Source:0) W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1717) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105) W/System.err: at android.os.Looper.loop(Looper.java:164) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6710) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Library version 1.3.2
So it only shows up on GL g6 with android 8.1.1. I guess its related to "For Android API level of 8.0.0, you should use WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY instead of LayoutParams.TYPE_TOAST or TYPE_APPLICATION_PANEL or SYSTEM_ALERT." from https://stackoverflow.com/questions/32224452/android-unable-to-add-window-permission-denied-for-this-window-type