use of org.prebid.mobile.rendering.sdk.deviceData.managers.LocationInfoManager in project prebid-mobile-android by prebid.
the class BaseJSInterface method getLocation.
@Override
@JavascriptInterface
public String getLocation() {
LocationInfoManager locationInfoManager = ManagersResolver.getInstance().getLocationManager();
JSONObject location = new JSONObject();
if (locationInfoManager.isLocationAvailable()) {
try {
location.put(LOCATION_LAT, locationInfoManager.getLatitude());
location.put(LOCATION_LON, locationInfoManager.getLongitude());
// type - static value "1" - GPS provider
location.put(LOCATION_TYPE, GeoLocationParameterBuilder.LOCATION_SOURCE_GPS);
location.put(LOCATION_ACCURACY, locationInfoManager.getAccuracy());
location.put(LOCATION_LASTFIX, locationInfoManager.getElapsedSeconds());
return location.toString();
} catch (JSONException e) {
LogUtil.error(TAG, "MRAID: Error providing location: " + Log.getStackTraceString(e));
}
}
return LOCATION_ERROR;
}
use of org.prebid.mobile.rendering.sdk.deviceData.managers.LocationInfoManager in project prebid-mobile-android by prebid.
the class GeoLocationParameterBuilder method appendBuilderParameters.
@Override
public void appendBuilderParameters(AdRequestInput adRequestInput) {
LocationInfoManager locationInfoManager = ManagersResolver.getInstance().getLocationManager();
DeviceInfoManager deviceManager = ManagersResolver.getInstance().getDeviceManager();
// Strictly ignore publisher geo values
adRequestInput.getBidRequest().getDevice().setGeo(null);
if (locationInfoManager != null) {
if (deviceManager != null && deviceManager.isPermissionGranted("android.permission.ACCESS_FINE_LOCATION")) {
setLocation(adRequestInput, locationInfoManager);
}
}
}
Aggregations