Search in sources :

Example 1 with ConnectionInfoManager

use of org.prebid.mobile.rendering.sdk.deviceData.managers.ConnectionInfoManager in project prebid-mobile-android by prebid.

the class Requester method makeAdRequest.

protected void makeAdRequest() {
    // Check if app has internet permissions
    DeviceInfoManager deviceManager = ManagersResolver.getInstance().getDeviceManager();
    if (deviceManager == null || !deviceManager.isPermissionGranted("android.permission.INTERNET")) {
        sendAdException("Either Prebid DeviceManager is not initialized or android.permission.INTERNET is not specified. Please check", "Internet permission not granted");
        return;
    }
    // Check if device is connected to the internet
    ConnectionInfoManager connectionInfoManager = ManagersResolver.getInstance().getNetworkManager();
    if (connectionInfoManager == null || connectionInfoManager.getConnectionType() == UserParameters.ConnectionType.OFFLINE) {
        sendAdException("Either Prebid networkManager is not initialized or Device is offline. Please check the internet connection", "No internet connection detected");
        return;
    }
    // Send ad request
    URLComponents jsonUrlComponents = buildUrlComponent();
    sendAdRequest(jsonUrlComponents);
}
Also used : URLComponents(org.prebid.mobile.rendering.networking.urlBuilder.URLComponents) DeviceInfoManager(org.prebid.mobile.rendering.sdk.deviceData.managers.DeviceInfoManager) ConnectionInfoManager(org.prebid.mobile.rendering.sdk.deviceData.managers.ConnectionInfoManager)

Example 2 with ConnectionInfoManager

use of org.prebid.mobile.rendering.sdk.deviceData.managers.ConnectionInfoManager in project prebid-mobile-android by prebid.

the class NetworkParameterBuilder method appendBuilderParameters.

@Override
public void appendBuilderParameters(AdRequestInput adRequestInput) {
    DeviceInfoManager deviceManager = ManagersResolver.getInstance().getDeviceManager();
    if (deviceManager != null) {
        String detectedMccMnc = deviceManager.getMccMnc();
        if (Utils.isNotBlank(detectedMccMnc)) {
            adRequestInput.getBidRequest().getDevice().mccmnc = detectedMccMnc;
        }
        String detectedCarrier = deviceManager.getCarrier();
        if (Utils.isNotBlank(detectedCarrier)) {
            adRequestInput.getBidRequest().getDevice().carrier = detectedCarrier;
        }
    }
    ConnectionInfoManager connectionInfoManager = ManagersResolver.getInstance().getNetworkManager();
    if (connectionInfoManager != null && deviceManager != null) {
        setNetworkParams(adRequestInput, deviceManager, connectionInfoManager);
    }
}
Also used : DeviceInfoManager(org.prebid.mobile.rendering.sdk.deviceData.managers.DeviceInfoManager) ConnectionInfoManager(org.prebid.mobile.rendering.sdk.deviceData.managers.ConnectionInfoManager)

Aggregations

ConnectionInfoManager (org.prebid.mobile.rendering.sdk.deviceData.managers.ConnectionInfoManager)2 DeviceInfoManager (org.prebid.mobile.rendering.sdk.deviceData.managers.DeviceInfoManager)2 URLComponents (org.prebid.mobile.rendering.networking.urlBuilder.URLComponents)1