Class OpenWrapSDK
-
- All Implemented Interfaces:
public class OpenWrapSDKProvides global configurations for the OpenWrap SDK, e.g. enabling logging, location access, etc. These configurations are globally applicable for OpenWrap SDK; you don't have to set these for every ad request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumOpenWrapSDK.LogLevelLog levels to filter logs
-
Field Summary
Fields Modifier and Type Field Description public final static StringKEY_SELECTED_REWARD
-
Constructor Summary
Constructors Constructor Description OpenWrapSDK()
-
Method Summary
Modifier and Type Method Description static voidinitialize(@NonNull() Context context, @NonNull() OpenWrapSDKConfig sdkConfig, @NonNull() OpenWrapSDKInitializer.Listener listener)Initializes the OpenWrap SDK with the provided configuration and context. static voidsetLogLevel(OpenWrapSDK.LogLevel level)Sets log level across all ad formats. static StringgetVersion()Returns the OpenWrap SDK's version. static voidallowLocationAccess(boolean allow)Used to enable/disable location access. static voidsetUseInternalBrowser(boolean internalBrowserState)Tells OpenWrap SDK to use the internal SDK browser, instead of the default device browser, for opening landing pages when the user clicks on an ad. static voidsetDSAComplianceStatus(@NonNull() POBDSAComplianceStatus dsaComplianceStatus)Sets the DSA (Digital Services Act) required flag. static POBDSAComplianceStatusgetDSAComplianceStatus()Gets the current DSA (Digital Services Act) required flag. static voidsetLocation(POBLocation location)Sets user's location and its source. static voidsetCoppa(boolean coppaState)Indicates whether the visitor is COPPA-specific or not. static voidsetSSLEnabled(boolean requestSecureCreative)Enable/disable secure ad calls. static voidallowAdvertisingId(boolean allow)Indicates whether Android advertisement ID should be sent in the request or not. static voidsetApplicationInfo(POBApplicationInfo applicationInfo)Sets Application information, which contains various attributes about app, such as application category, store URL, domain, etc for more relevant ads. static POBApplicationInfogetApplicationInfo()Gets Application info set by publisher to OpenWrap SDK static voidsetUserInfo(POBUserInfo userInfo)Sets user information, such as birth year, gender, region, etc for more relevant ads. static POBUserInfogetUserInfo()Gets user info set by publisher to OpenWrap SDK static voidaddExternalUserId(@NonNull() POBExternalUserId userId)API to Add the External user id /Data Partner ids which helps publisher in better user targeting static List<POBExternalUserId>getExternalUserIds()API to get all set external user ids static voidremoveExternalUserIds(@NonNull() String source)API to remove the external user ids of a particular source static voidremoveAllExternalUserIds()API to remove all external user ids -
-
Method Detail
-
initialize
@AnyThread() static void initialize(@NonNull() Context context, @NonNull() OpenWrapSDKConfig sdkConfig, @NonNull() OpenWrapSDKInitializer.Listener listener)
Initializes the OpenWrap SDK with the provided configuration and context. This static method serves as a convenient entry point to initialize the OpenWrap SDK using the specified context and SDK configuration. Upon completion of the initialization process, the specified listener is notified of the outcome through its onSuccess or onFailure methods.
- Parameters:
context- The context, used for SDK initialization.sdkConfig- The configuration settings for the OpenWrap SDK, including publisher ID and profile IDs.listener- An implementation of the OpenWrapSDKInitializer.Listener interface, which will be notified upon the success or failure of the SDK initialization.
-
setLogLevel
static void setLogLevel(OpenWrapSDK.LogLevel level)
Sets log level across all ad formats. Default log level is LogLevel.Warn. For more details refer OpenWrapSDK.LogLevel
- Parameters:
level- log level to set.
-
getVersion
static String getVersion()
Returns the OpenWrap SDK's version.
- Returns:
sdk version
-
allowLocationAccess
static void allowLocationAccess(boolean allow)
Used to enable/disable location access. This value decides whether the OpenWrap SDK should access device location using Core Location APIs to serve location-based ads. When set to false, the SDK will not attempt to access device location. When set to true, the SDK will periodically try to fetch location efficiently. Note that, this only occurs if location services are enabled and the user has already authorized the use of location services for the application. The OpenWrap SDK never asks permission to use location services by itself.
The default value is true.
- Parameters:
allow- enable or disable location access behavior
-
setUseInternalBrowser
static void setUseInternalBrowser(boolean internalBrowserState)
Tells OpenWrap SDK to use the internal SDK browser, instead of the default device browser, for opening landing pages when the user clicks on an ad. By default, the use of an internal browser is disabled.
From version 2.7.0, the default behaviour changed to using device's default browser
- Parameters:
internalBrowserState- boolean value that enables/disables the use of internal browser.
-
setDSAComplianceStatus
static void setDSAComplianceStatus(@NonNull() POBDSAComplianceStatus dsaComplianceStatus)
Sets the DSA (Digital Services Act) required flag.
- Parameters:
dsaComplianceStatus- DSA required flag.
-
getDSAComplianceStatus
static POBDSAComplianceStatus getDSAComplianceStatus()
Gets the current DSA (Digital Services Act) required flag. NOT_REQUIRED = Not required OPTIONAL = Supported, bid responses with or without the DSA object will be accepted REQUIRED = Required, bid responses without a DSA object will not be accepted REQUIRED_PUB_ONLINE_PLATFORM = Required, bid responses without DSA object will not be accepted, Publisher is an Online Platform
-
setLocation
static void setLocation(POBLocation location)
Sets user's location and its source. It is useful in delivering geographically relevant ads.
If your application is already accessing the device location, it is highly recommended to set the location coordinates inferred from the device GPS. If you are inferring location from any other source, make sure you set the appropriate location source.
- Parameters:
location- User's current location
-
setCoppa
static void setCoppa(boolean coppaState)
Indicates whether the visitor is COPPA-specific or not. For COPPA (Children's Online Privacy Protection Act) compliance, if the visitor's age is below 13, then such visitors should not be served targeted ads. Possible options are: false - Indicates that the visitor is not COPPA-specific and can be served targeted ads. true - Indicates that the visitor is COPPA-specific and should be served only COPPA-compliant ads.
- Parameters:
coppaState- Visitor state for COPPA compliance.
-
setSSLEnabled
static void setSSLEnabled(boolean requestSecureCreative)
Enable/disable secure ad calls.
By default, OpenWrap SDK initiates secure ad calls from an application to the ad server and delivers only secure ads. You can allow non secure ads by passing false to this method.
- Parameters:
requestSecureCreative- false for disable secure creative mode.
-
allowAdvertisingId
static void allowAdvertisingId(boolean allow)
Indicates whether Android advertisement ID should be sent in the request or not. By default advertisement ID will be used.
Possible values are: true : Advertisement id will be sent in the request. false : Advertisement id will not be sent in the request.
- Parameters:
allow- state of advertisement id usage
-
setApplicationInfo
static void setApplicationInfo(POBApplicationInfo applicationInfo)
Sets Application information, which contains various attributes about app, such as application category, store URL, domain, etc for more relevant ads.
- Parameters:
applicationInfo- Instance of POBApplicationInfo class with required application details
-
getApplicationInfo
@Nullable() static POBApplicationInfo getApplicationInfo()
Gets Application info set by publisher to OpenWrap SDK
- Returns:
instance of POBApplicationInfo class
-
setUserInfo
static void setUserInfo(POBUserInfo userInfo)
Sets user information, such as birth year, gender, region, etc for more relevant ads.
- Parameters:
userInfo- Instance of POBUserInfo class with required user details
-
getUserInfo
@Nullable() static POBUserInfo getUserInfo()
Gets user info set by publisher to OpenWrap SDK
- Returns:
instance of POBUSerInfo class
-
addExternalUserId
static void addExternalUserId(@NonNull() POBExternalUserId userId)
API to Add the External user id /Data Partner ids which helps publisher in better user targeting
- Parameters:
userId- instance of POBExternalUserId class
-
getExternalUserIds
@NonNull() static List<POBExternalUserId> getExternalUserIds()
API to get all set external user ids
-
removeExternalUserIds
static void removeExternalUserIds(@NonNull() String source)
API to remove the external user ids of a particular source
- Parameters:
source- name of source
-
removeAllExternalUserIds
static void removeAllExternalUserIds()
API to remove all external user ids
-
-
-
-