From 1a873d79f6d3dc214bdaaf709bd4c72cf3ff3390 Mon Sep 17 00:00:00 2001 From: Miranda Wilson Date: Fri, 26 Jan 2024 09:41:35 +0000 Subject: [PATCH] Remove use of WindowManager (close #657) --- .../java/com/snowplowanalytics/core/tracker/Subject.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Subject.kt b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Subject.kt index b7cf2132a..ca8183ac8 100755 --- a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Subject.kt +++ b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Subject.kt @@ -13,8 +13,6 @@ package com.snowplowanalytics.core.tracker import android.content.Context -import android.graphics.Point -import android.view.WindowManager import com.snowplowanalytics.core.constants.Parameters import com.snowplowanalytics.core.tracker.Logger.v import com.snowplowanalytics.snowplow.util.Size @@ -225,11 +223,9 @@ class Subject(context: Context, config: SubjectConfigurationInterface?) { * @param context the android context */ private fun setDefaultScreenResolution(context: Context) { - val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as? WindowManager - val display = windowManager?.defaultDisplay - val size = Point() - display?.getSize(size) - screenResolution = (Size(size.x, size.y)) + val width = context.resources.displayMetrics.widthPixels + val height = context.resources.displayMetrics.heightPixels + screenResolution = (Size(width, height)) } /**