11package com .mparticle .internal ;
22
3+ import android .app .Application ;
34import android .content .Context ;
45import android .content .SharedPreferences ;
56import android .content .pm .ApplicationInfo ;
89import android .os .Build ;
910import android .telephony .TelephonyManager ;
1011import android .util .DisplayMetrics ;
11- import android .view .WindowManager ;
1212
1313import com .mparticle .MParticle ;
1414import com .mparticle .internal .Constants .MessageKey ;
@@ -196,9 +196,9 @@ JSONObject getStaticDeviceInfo(Context appContext) {
196196 attributes .put (MessageKey .OS_VERSION_INT , Build .VERSION .SDK_INT );
197197 attributes .put (MessageKey .MODEL , android .os .Build .MODEL );
198198 attributes .put (MessageKey .RELEASE_VERSION , Build .VERSION .RELEASE );
199-
199+ Application application = ( Application ) appContext ;
200200 // device ID
201- addAndroidId (attributes , appContext );
201+ addAndroidId (attributes , application );
202202
203203 attributes .put (MessageKey .DEVICE_BLUETOOTH_ENABLED , MPUtility .isBluetoothEnabled (appContext ));
204204 attributes .put (MessageKey .DEVICE_BLUETOOTH_VERSION , MPUtility .getBluetoothVersion (appContext ));
@@ -210,12 +210,11 @@ JSONObject getStaticDeviceInfo(Context appContext) {
210210 attributes .put (MessageKey .DEVICE_ROOTED , rootedObject );
211211
212212 // screen height/width
213- WindowManager windowManager = (WindowManager ) appContext .getSystemService (Context .WINDOW_SERVICE );
214- DisplayMetrics metrics = new DisplayMetrics ();
215- windowManager .getDefaultDisplay ().getMetrics (metrics );
216- attributes .put (MessageKey .SCREEN_HEIGHT , metrics .heightPixels );
217- attributes .put (MessageKey .SCREEN_WIDTH , metrics .widthPixels );
218- attributes .put (MessageKey .SCREEN_DPI , metrics .densityDpi );
213+ DisplayMetrics displayMetrics = appContext .getResources ().getDisplayMetrics ();
214+
215+ attributes .put (MessageKey .SCREEN_HEIGHT , displayMetrics .heightPixels );
216+ attributes .put (MessageKey .SCREEN_WIDTH , displayMetrics .widthPixels );
217+ attributes .put (MessageKey .SCREEN_DPI , displayMetrics .densityDpi );
219218
220219 // locales
221220 Locale locale = Locale .getDefault ();
0 commit comments