public class Vungle
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Vungle.Consent
GDPR Consent Status
|
Modifier and Type | Method and Description |
---|---|
static boolean |
canPlayAd(java.lang.String id)
Check if we can play an advertisement for the given placement.
|
static boolean |
closeFlexViewAd(java.lang.String placementReferenceId)
Closes currently playing Ad (only for Native FlexView , not supported for the Interstitial Ad formats)
Currently ability to close already Playing ad is supported only for Placements
that show FlexView ads.
|
static java.lang.String |
getConsentMessageVersion() |
static Vungle.Consent |
getConsentStatus() |
static VungleNativeAd |
getNativeAd(java.lang.String placementId,
AdConfig adConfig,
PlayAdCallback playAdCallback)
VungleNativeAd can be used inside any Android view container.
|
static VungleNativeAd |
getNativeAd(java.lang.String placementId,
PlayAdCallback playAdCallback)
Deprecated.
|
static java.util.Collection<java.lang.String> |
getValidPlacements() |
static void |
init(java.util.Collection<java.lang.String> placements,
java.lang.String appId,
android.content.Context context,
InitCallback callback)
Deprecated.
|
static void |
init(java.lang.String appId,
android.content.Context context,
InitCallback callback)
Initialize the Vungle SDK
|
static void |
init(java.lang.String appId,
android.content.Context context,
InitCallback callback,
VungleSettings settings)
Initialize the Vungle SDK
|
static boolean |
isInitialized()
Checks if Vungle's SDK is already in initialized state
|
static void |
loadAd(java.lang.String id,
LoadAdCallback callback)
Request the Vungle SDK to load the assets for an advertisement by the placement identifier.
|
static void |
playAd(java.lang.String id,
AdConfig settings,
PlayAdCallback callback)
Play an ad for the given placement ID.
|
static void |
setHeaderBiddingCallback(com.vungle.warren.HeaderBiddingCallback headerBiddingCallback)
Method to register Header bidding callback.
|
static void |
setIncentivizedFields(java.lang.String userID,
java.lang.String title,
java.lang.String body,
java.lang.String keepWatching,
java.lang.String close)
Overrides the previously-set incentivized fields which are used when warning the user if they
are attempting to exit an incentivized advertisement prematurely.
|
static void |
setUserLegacyID(java.lang.String legacyId)
Set the user's legacy ID to pass through to Third Party Trackers for Attribution
This would be effective only if this feature is enabled.
|
static void |
updateConsentStatus(Vungle.Consent status,
java.lang.String consentMessageVersion)
If handling GDPR Consent dialog with own implementation, use this dialog to update Vungle on
user consent status.
|
@Deprecated public static void init(@NonNull java.util.Collection<java.lang.String> placements, @NonNull java.lang.String appId, @NonNull android.content.Context context, @NonNull InitCallback callback) throws java.lang.IllegalArgumentException
init(String, Context, InitCallback)
This method exists for backward compatibility. Placements pass in this method are ignored by the SDK.
Placements will be filled in from the dashboard to get a list of Valid Placements, call
getValidPlacements()
after Vungle is initialized successfullyplacements
- Placements pass here will no longer be passed into SDK. Placements will be passed in from the dashboard.appId
- The identifier for the publisher application. This can be found in the vungle
dashboard.context
- Application context.callback
- Callback that will be triggered once initialization has completed, or if any errors occur.java.lang.IllegalArgumentException
- if InitCallback is nullpublic static void init(@NonNull java.lang.String appId, @NonNull android.content.Context context, @NonNull InitCallback callback) throws java.lang.IllegalArgumentException
appId
- The identifier for the publisher application. This can be found in the vungle
dashboard.context
- Application context.callback
- Callback that will be triggered once initialization has completed, or if any errors occur.java.lang.IllegalArgumentException
- if InitCallback is nullpublic static void init(@NonNull java.lang.String appId, @NonNull android.content.Context context, @NonNull InitCallback callback, @NonNull VungleSettings settings) throws java.lang.IllegalArgumentException
appId
- The identifier for the publisher application. This can be found in the vungle
dashboard.context
- Application context.callback
- Callback that will be triggered once initialization has completed, or if any errors occur.settings
- Vungle's settingsjava.lang.IllegalArgumentException
- if InitCallback is nullpublic static boolean isInitialized()
public static void setIncentivizedFields(@Nullable java.lang.String userID, @Nullable java.lang.String title, @Nullable java.lang.String body, @Nullable java.lang.String keepWatching, @Nullable java.lang.String close)
playAd(String, AdConfig, PlayAdCallback)
is called.title
- The dialog box titlebody
- The dialog box body text. Values longer than the space allows for will be ellipsised
at the end.keepWatching
- Continue button textclose
- Close button text.public static boolean canPlayAd(@NonNull java.lang.String id)
id
- The placement identifier.public static void playAd(@NonNull java.lang.String id, AdConfig settings, @Nullable PlayAdCallback callback)
VungleActivity
to start and the advertisement
will be rendered.id
- The placement identifier.settings
- Optional settings for playing the advertisement. The full list can be found
at AdConfig
documentation.callback
- Optional, though strongly encouraged, event listener. This object will be
notified of the advertisement starting, ending, and any errors that occur
during rendering.public static void loadAd(@NonNull java.lang.String id, @Nullable LoadAdCallback callback)
id
- The placement identifier for which assets should be loaded.callback
- The optional callback which will be notified when the assets are loaded, or
if they are deferred. Errors will also be sent through this callback.@Deprecated @Nullable public static VungleNativeAd getNativeAd(java.lang.String placementId, PlayAdCallback playAdCallback)
placementId
- - placementId for Native ad Placement configured for the right AdSizeplayAdCallback
- - Callback to receive onAdStart, onAdEnd, onAdError Callbacks@Nullable public static VungleNativeAd getNativeAd(java.lang.String placementId, AdConfig adConfig, PlayAdCallback playAdCallback)
placementId
- - placementId for Native ad Placement configured for the right AdSizeadConfig
- - Set the AdConfig.AdSize
for Native Ad view corresponding to the Placement configurationplayAdCallback
- - Callback to receive onAdStart, onAdEnd, onAdError Callbackspublic static java.util.Collection<java.lang.String> getValidPlacements()
public static void updateConsentStatus(@NonNull Vungle.Consent status, @NonNull java.lang.String consentMessageVersion)
Updates the data-gathering consent status of the user. This is gathered by the publisher and provided to Vungle. It is then stored on disk and used whenever we are sending information to the ad server.
status
- If true, the user has consented to us gathering data about their device.consentMessageVersion
- Optional version string that can be passed indicating the version
of your shown consent message users acted onpublic static Vungle.Consent getConsentStatus()
public static java.lang.String getConsentMessageVersion()
public static boolean closeFlexViewAd(@NonNull java.lang.String placementReferenceId)
placementReferenceId
- placement id.public static void setUserLegacyID(java.lang.String legacyId)
init(String, Context, InitCallback)
.legacyId
- any legacyID that can use used to uniquely identify user for attributionpublic static void setHeaderBiddingCallback(com.vungle.warren.HeaderBiddingCallback headerBiddingCallback)
headerBiddingCallback
- HeaderBiddingCallback
instance to get notified about
bidding token and ad availability.