0 purchases
vmax flutter
vmax_flutter #
VmaxFlutter SDK allows the publishers to display wide variety of ads.
Getting Started #
Prerequisites for iOS #
Use Xcode 14.1 or higher
Target iOS 12.0 or higher
Prerequisites for Android #
Add below entry in AndroidManifest.xml
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" />
copied to clipboard
Initialize VmaxFlutterManager #
It's the first & foremost step in VmaxFlutter SDK. Publishers need to initialize the VmaxFlutterManager class before making an ad request.
To initialize VmaxFlutterManager you need to register with Vmax & generate an accountId, appId & secretKey from the Vmax Console
Before Initializing the VmaxFlutterManager developer needs to initialize VmaxFlutterUser first & pass user-specific targeting information. User-related parameters like id, gender, age, city, region, country, zip-code & keywords that can be used for custom targeting:
VmaxFlutterUser vmaxUser = VmaxFlutterUser.instance;
vmaxUser.setId("USER_ID");
vmaxUser.setGender("USER_GENDER");
vmaxUser.setAge("USER_AGE");
vmaxUser.setCity("USER_CITY");
vmaxUser.setRegion("USER_REGION");
vmaxUser.setCountry("USER_COUNTRY");
vmaxUser.setZipCode("USER_ZIPCODE");
vmaxUser.setKeywords(["USER_KEYWORD"]);
copied to clipboard
Now use the appId, accountId & secretKey in VmaxFlutterManager initialize(accountId:, appId:, secretKey:, listener:) method to set up the VmaxFlutter SDK. Use InitializationStatusListener for relevant Initialization status.
Initializing VmaxFlutter library will validate the appId, get targeting data for users using accountId & secretKey, and fetch the user-agent, IDFA, and device information used in every subsequent ad request.
VmaxFlutterManager.instance.initialize(accountId: ACCOUNT_ID, appId: APP_ID, secretKey: "SECRET_KEY", listener: InitializationStatusListener(
onSuccess: (){
print("VmaxManager Initialization Success");
},
onFailure: (){
print("VmaxManager Initialization Failed");
})
);
copied to clipboard
VmaxFlutterDevice #
VmaxFlutterDevice class is responsible for device-related targeting information. Certain information like User Agent, IFA, IFA-based user restrictions, device type, make, model, OS, OS version, language, carrier and connection type are prefetched by the SDK during the initialization process.
Update Device Information (Optional)
For custom targeting values like make, model, OS, OS version, platform & marketing name can be overridden by the publisher. After updating the device related values you need to call updateVmaxDevice method to reflect those parameters in Ad Request.
VmaxFlutterDevice vmaxDevice = VmaxFlutterDevice.instance;
vmaxDevice.setMake("DEVICE_MAKE");
vmaxDevice.setModel("DEVICE_MODEL");
vmaxDevice.setOS("DEVICE_OS");
vmaxDevice.setOSVersion("DEVICE_OS_VERSION");
vmaxDevice.setPlatform(DEVICE_PLATFORM);
vmaxDevice.setMarketingName("DEVICE_MARKETING_NAME");
copied to clipboard
VmaxFlutterApplication #
VmaxFlutterApplication class is responsible for App specific targeting.
Update Application Information (Optional)
For custom targeting values like custom data and keywords can be overridden by the publisher. After updating the application related values you need to call updateVmaxApplication method to reflect those parameters in Ad Request.
VmaxFlutterApplication vmaxApplication = VmaxFlutterApplication.instance;
vmaxApplication.setCustomData(["CUSTOM_KEY":"CUSTOM_VALUE"]);
vmaxApplication.setKeywords(["CUSTOM_KEYWORD"]);
copied to clipboard
Create AdSpace #
VmaxFlutterAdSpace represents a space reserved for displaying a single ad. Developers can use this space to display a wide variety of ads.
To display an ad you need to create TAG_ID from the Vmax console and then use it to monetize the adSpace.
Developers need to listen for VmaxFlutterAdSpaceListener which tells them the current state of the adSpace.
To create VmaxFlutterAdSpace follow these steps to create one:
NOTE:- VmaxFlutterManager InitializationStatusListener status should be successful before creating a VmaxFlutterAdSpace.
Create an instance of VmaxFlutterAdSpace by providing tagId & registering VmaxFlutterAdSpaceListener in the constructor of VmaxFlutterAdSpace.
VmaxFlutterAdSpace _adSpace = VmaxFlutterAdSpace(tagId: "TAG_ID", listener: VmaxFlutterAdSpaceListener(
onAdReady: () {
print("VmaxFlutterAdSpace onAdReady");
},
onAdRender: (){
print("VmaxFlutterAdSpace onAdRender");
},
onAdError: () {
print("VmaxFlutterAdSpace onAdError");
},
onAdClick: (){
print("VmaxFlutterAdSpace onAdClick");
})
);
copied to clipboard
After creating a VmaxFlutterAdSpace, you need to call the cacheAd() to send an ad request to the Vmax server.
When you receive a callback from onAdReady from VmaxFlutterAdSpaceListener use the VmaxWidget class & pass the VmaxFlutterAdSpace object in them.
VmaxWidget(adSpace: _adSpace)
copied to clipboard
What is VmaxWidget? #
VmaxWidget displays a VmaxFlutterAdSpace as a Flutter widget.
The developer must call the cacheAd() before showing the widget. Otherwise, a PlatformException will be thrown.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.