java.lang.RuntimeException: Error receiving broadcast Intent {…
- User
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.uniper.uniapp.remote.OnZoomAlert flg=0x10 (has extras) } in com.uniper.uniapp.zoomRedesign.RedesignedMeetingActivityz@20a6300 at android.app.LoadedApkArgs.run(LoadedApk.java:1132) at android.os.Handler.handleCallback(Handler.java:755) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6141) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
- Assistant
This error is caused by a
BadTokenExceptionthat occurs when trying to add a window that is not allowed to be displayed on top of other windows. The system throws aBadTokenExceptionwith the message "permission denied for window type 2002".The error occurs in the
BaseOverlayView.show()method, which tries to add a window to the WindowManager usingWindowManager.addView(). This method requires theandroid.permission.SYSTEM_ALERT_WINDOWpermission, which allows an app to create windows that are shown on top of other windows. If the app does not have this permission, the system will throw aBadTokenExceptionand prevent the window from being added.To fix this issue, the app needs to request the
SYSTEM_ALERT_WINDOWpermission in the AndroidManifest.xml file and then request the permission at runtime. This can be done using theSettings.ACTION_MANAGE_OVERLAY_PERMISSIONintent to prompt the user to grant the permission.Additionally, it's important to check if the app has the permission before trying to add a window to the WindowManager. This can be done using the method, which returns true if the app has the required permission.