Getting Started (2.0)
Integrating BuzzAdPop SDK for Android
The below items are necessary to proceed with the integration:
Request the following to Buzzvil's BD manager
app_id
unit_id
Provide your
postback url
to Buzzvil's BD managerPostback API document (link)
Prerequisites
Android Studio 3.2 or higher
minSdkVersion
15 or highercompileSdkVersion
29 or higher
Index
Step 1: Installation
BuzzAdPop is distributed as part of the BuzzAdBenefit SDK.
Add the dependencies in build.gradle
repositories {
maven { url "https://dl.buzzvil.com/public/maven" }
}
dependencies {
implementation "com.buzzvil:buzzad-benefit-pop:2.2.2"
}
If BuzzAd Benefit was already integrated, remove the following code from build.gradle.
Step 2: Initialization
As BuzzAdPop is distributed as part of the BuzzAdBenefit SDK, BuzzAd Pop is initialized via BuzzAd Benefit.. BuzzAd Pop can be initialized by calling BuzzAdBenefit.init()
with configurations that includes unit_id
, app_id
and more (See Initializing Pop for more details). The initialization needed only once when running the app. The code below is an example of initializing BuzzAd Pop from Application class.
package ...
import ...
import com.buzzvil.buzzad.benefit.BuzzAdBenefit;
import com.buzzvil.buzzad.benefit.BuzzAdBenefitConfig;
import com.buzzvil.buzzad.benefit.presentation.pop.PopConfig;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
final PopConfig popConfig = new PopConfig.Builder(getApplicationContext(), "POP_UNIT_ID_HERE")
.build();
final BuzzAdBenefitConfig buzzAdBenefitConfig = new BuzzAdBenefitConfig.Builder("BENEFIT_APP_ID_HERE")
.add(popConfig)
.build();
BuzzAdBenefit.init(this, buzzAdBenefitConfig);
}
}
Step 3: Setting the UserProfile
User ID and targeting information (gender, birth year) is necessary for the proper functioning of BuzzAd Benefit. Ads are served only after the setUserProfile
method is called.
Please set the UserProfile
at the user login.
userId : A unique identifier assigned to each user
Please consult with the BD manager if there is a possibility of
userId
changing.e.g.:
userId
changes when a user re-installs the app after deletion
gender
UserProfile.Gender.MALE
UserProfile.Gender.FEMALE
birthYear
final UserProfile.Builder builder = new UserProfile.Builder(BuzzAdBenefit.getUserProfile());
final UserProfile userProfile = builder
.userId("Your_Service_User_ID")
.gender(UserProfile.Gender.MALE)
.birthYear(1985)
.build();
BuzzAdBenefit.setUserProfile(userProfile);
Please set UserProfile to null upon logging out.
Step 4: Setting the Permission
For proper functioning of BuzzAd Pop, Draw Over Other Apps
permission is necessary. This requires the user to enable the permission for the app integrating BuzzAd Pop. BuzzAd Pop provides facile methods to gain the permission from users.
Add
BuzzAdPop
class as a variable to the Activity that will set the permission for BuzzAd Pop.Create an instance of
BuzzAdPop
using theunit_id
of the BuzzAd Pop inonCreate
of the Activity.The below is the code to request the permission from users.
The user will return to their original Activity once the permission is enabled in Settings. The value passed via Intent provides information on whether the permission has been granted or not.
Step 5. Activation
Call buzzAdPop.showPop()
to activate BuzzAd Pop. Once activated, the foreground service will start running and BuzzAd Pop will be displayed continuously whenever the screen is turned on. For effective operation call BuzzAdPop.showPop()
with the ad preloaded.
UI Customization
Changing CTA color and incorporating features like MessagePreview can be done via UI Customization.
Additional Resource
Sample app for BuzzAd Pop (GitHub)