static String reflectedGetAdvertisingId(final Object adInfo, final String defaultValue) { try { return (String) MethodBuilderFactory.create(adInfo, "getId").execute(); } catch (Exception exception) { return defaultValue; } }
static boolean reflectedIsLimitAdTrackingEnabled( final Object adInfo, final boolean defaultValue) { try { Boolean result = (Boolean) MethodBuilderFactory.create(adInfo, "isLimitAdTrackingEnabled").execute(); return (result != null) ? result : defaultValue; } catch (Exception exception) { return defaultValue; } }
static boolean isGpsAvailable(final Context context) { try { MethodBuilder methodBuilder = MethodBuilderFactory.create(null, "isGooglePlayServicesAvailable") .setStatic(Class.forName(sPlayServicesUtilClassName)) .addParam(Context.class, context); Object result = methodBuilder.execute(); return (result != null && (Integer) result == GOOGLE_PLAY_SUCCESS_CODE); } catch (Exception exception) { return false; } }