Object POBCommonOrtbJsonHelper

  • All Implemented Interfaces:

    
    public class POBCommonOrtbJsonHelper
    
                        

    Helper object keeps common ORTB json objects/APIs

    • Constructor Detail

    • Method Detail

      • getImpressionJsonArray

         final static JSONArray getImpressionJsonArray(POBRequest request)

        Generates a JSONArray of impressions from a given POBRequest. Iterates through each impression in the request, converts it to a JSONObject using getImpressionJson(), and adds it to the JSONArray. Any JSONException encountered during the conversion is logged as an error.

        Parameters:
        request - The POBRequest containing impressions to be converted.
        Returns:

        A JSONArray containing the converted impressions.

      • getDeviceObject

         final static JSONObject getDeviceObject(POBDeviceInfo deviceInfo, POBLocationDetector locationDetector, Context context)

        Builds oRTB specific device info json, Internally it uses device info POBDeviceInfo to fetch device specific values.

        Returns:

        the device json

      • getMeasurementJson

         final static JSONObject getMeasurementJson()

        Generates a JSON object containing measurement information, including partner name and SDK version. This information is structured under an 'ext' key. If an error occurs during JSON object creation, the error is logged, and null is returned.

      • getUserJson

         final static JSONObject getUserJson(Context context, POBAdFormat placementType)

        Create ortb user json for ad request

        Returns:

        the user json

      • addGpp

         final Unit addGpp(Context context, JSONObject regsExt)

        Add GPP to regs ext json if available in shared preference.

        Parameters:
        context - the application context
        regsExt - the regs ext json object
      • addGppSid

         final Unit addGppSid(Context context, JSONObject regsExt)

        Add GPP SID to regs ext json if available in shared preference.

        Parameters:
        context - the application context
      • addParamToJson

         final static Unit addParamToJson(JSONObject json, String key, String param)

        Helps you add new key and value to the json object. Adds a parameter to a JSON object if the parameter is not null or empty. If the JSON object is not null and the parameter value is valid, the parameter is added to the JSON object with the specified key. If the operation fails due to a JSONException, a warning is logged.

        Parameters:
        json - The JSON object to which the parameter should be added.
        key - The key under which the parameter should be added.
        param - The parameter value to add; it will be ignored if null or empty.
      • getGeoObject

         final static JSONObject getGeoObject(POBLocationDetector locationDetector, POBDeviceInfo deviceInfo)