You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using version 8.0.1 and we get this errors in logcat when initializing mixpanel.
We initialize mixpanel in hilt using application context (no visual content) we need mixpanel in background work broadcast receivers etc and won't have a WindowManager at all times.
mixpanel tries to access display with the following code:
I would suggest to use displaymanager to get the default display instead of WindowManager:
val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
val display: Display = displayManager.getDisplay(Display.DEFAULT_DISPLAY)
Stacktrace:
Tried to access visual service WindowManager from a non-visual Context:xxx.xxx.xxx WindowManager should be accessed from Activity or other visual Context. Use an Activity or a Context created with Context#createWindowContext(int, Bundle), which are adjusted to the configuration and visual bounds of an area on screen. (Ask Gemini)
java.lang.IllegalAccessException: Tried to access visual service WindowManager from a non-visual Context:xxx.xxx.xxx@fed68d3
at android.app.ContextImpl.getSystemService(ContextImpl.java:2115)
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:900)
at com.mixpanel.android.mpmetrics.SystemInformation.<init>(SystemInformation.java:91)
at com.mixpanel.android.mpmetrics.SystemInformation.getInstance(SystemInformation.java:34)
at com.mixpanel.android.mpmetrics.AnalyticsMessages$Worker$AnalyticsMessageHandler.<init>(AnalyticsMessages.java:361)
at com.mixpanel.android.mpmetrics.AnalyticsMessages$Worker.restartWorkerThread(AnalyticsMessages.java:354)
at com.mixpanel.android.mpmetrics.AnalyticsMessages$Worker.<init>(AnalyticsMessages.java:329)
at com.mixpanel.android.mpmetrics.AnalyticsMessages.createWorker(AnalyticsMessages.java:52)
at com.mixpanel.android.mpmetrics.AnalyticsMessages.<init>(AnalyticsMessages.java:47)
at com.mixpanel.android.mpmetrics.AnalyticsMessages.getInstance(AnalyticsMessages.java:71)
at com.mixpanel.android.mpmetrics.MixpanelAPI.getAnalyticsMessages(MixpanelAPI.java:1706)
at com.mixpanel.android.mpmetrics.MixpanelAPI.<init>(MixpanelAPI.java:156)
at com.mixpanel.android.mpmetrics.MixpanelAPI.<init>(MixpanelAPI.java:122)
at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:466)
at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:239)
The text was updated successfully, but these errors were encountered:
We are using version 8.0.1 and we get this errors in logcat when initializing mixpanel.
We initialize mixpanel in hilt using application context (no visual content) we need mixpanel in background work broadcast receivers etc and won't have a WindowManager at all times.
mixpanel tries to access display with the following code:
(getDefaultDisplay is deprecated btw)
I would suggest to use displaymanager to get the default display instead of WindowManager:
Stacktrace:
The text was updated successfully, but these errors were encountered: