Android O permission denied for window type 2006
See original GitHub issue06-19 22:18:06.485 27339-27339/com.example.mateen.gcmtesting E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.mateen.gcmtesting, PID: 27339 java.lang.RuntimeException: Unable to start service com.example.mateen.gcmtesting.ActionServices.CameraService@edc3f43 with Intent { cmp=com.example.mateen.gcmtesting/.ActionServices.CameraService (has extras) }: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@8da1cf2 -- permission denied for window type 2006 at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3556) at android.app.ActivityThread.-wrap20(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@8da1cf2 -- permission denied for window type 2006 at android.view.ViewRootImpl.setView(ViewRootImpl.java:788) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:92) at com.androidhiddencamera.HiddenCameraService.addPreView(HiddenCameraService.java:125) at com.androidhiddencamera.HiddenCameraService.startCamera(HiddenCameraService.java:82) at com.example.mateen.gcmtesting.ActionServices.CameraService.onStartCommand(CameraService.java:100) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3539) at android.app.ActivityThread.-wrap20(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
this error comes when i call the service to take the picture in android O
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
i have found the solution there need to change only one Flag which android O deprecated you may can appreciate me later 😛 change your flag Windomanger flag “TYPE_SYSTEM_OVERLAY” to “TYPE_APPLICATION_OVERLAY” please make these changes in your project to make compatible with upcoming android O
@Mateeen Thank you. I will change this and update this in upcoming release.