Skip to content

Commit

Permalink
Remove use of WindowManager (close #657)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Jan 26, 2024
1 parent 5975f74 commit 1a873d7
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}

/**
Expand Down

0 comments on commit 1a873d7

Please sign in to comment.