bidmad_plugin 0.7.0+1 bidmad_plugin: ^0.7.0+1 copied to clipboard
Flutter Plugin for using BidmadSDK
Introduce #
BidmadPlugin is a plugin for using Bidmad, a mobile app advertisement SDK, in Flutter.
You can use the plugin to serve banner/interstitial/reward ads in your flutter mobile app.
*If only Android is supported in the current version, iOS will be supported soon.
Programming Guide #
1. Android Setting #
1.1) Build.gradle Setting
Add Build Gradle settings to apply Android SDK.
repositories {
...
google()
jcenter()
maven { url "https://dl.bintray.com/adop-repo/SDK" } //bidmad
maven { url "http://devrepo.kakao.com:8088/nexus/content/groups/public/" } //Adift
maven {
url "s3://repo.cauly.net/releases"
credentials(AwsCredentials) {
accessKey "AKIAWRZUK5MFKYVSUOLB"
secretKey "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"
}
} //Cauly
maven { url "https://tapjoy.bintray.com/maven" } //Tapjoy
}
dependencies {
...
implementation 'com.adop.sdk:bidmad-androidx:1.12.2'
}
1.2) Init Channel
Set Bidmad Channel in MainActivity to communicate with AndroidSDK.
...
import com.adop.sdk.FlutterCommon
class MainActivity: FlutterActivity() {
private var binaryMessenger: BinaryMessenger? = null
private var common : FlutterCommon? = null
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
binaryMessenger = flutterEngine.dartExecutor.binaryMessenger
common = FlutterCommon(this);
common!!.initChannel(binaryMessenger)
}
}
2. Using Plugin #
2.1) Banner AD
The following is an example of requesting a Banner ad.
....//Banner init
FlutterBidmadCommon common = FlutterBidmadCommon();
FlutterBaseBanner banner;
common.initBannerChannel().then((value) {
String _channelNm = value;
banner = FlutterBaseBanner(
channelName: _channelNm
);
banner.setAdInfo("Your Zone Id");
banner.setCallbackListener(
onLoadAd: (String zoneId){
print("banner onLoadAd");
},
onFailAd: (String zoneId){
print("banner onFailAd");
}
);
//option
//banner.setInterval(120); //banner refresh time(60s~120s)
});
....//Banner Load
banner.load(300); //set Position Y(height)
....//Banner Remove
banner.removeAdView();
2.2) Interstitial AD
The following is an example of requesting a Interstitial ad.
....//Interstitial init
FlutterBidmadCommon common = FlutterBidmadCommon();
FlutterBaseInterstitial interstitial;
common.initInterstitialChannel().then((value) {
String _channelNm = value;
interstitial = FlutterBaseInterstitial(
channelName: _channelNm
);
interstitial.setAdInfo("Your Zone Id");
interstitial.setCallbackListener(
onLoadAd: (String zoneId){
print("interstitial onLoadAd");
},
onShowAd: (String zoneId){
print("interstitial onShowAd" );
interstitial.load(); //Ad Reload
},
onCloseAd: (String zoneId){
print("interstitial onCloseAd");
},
onFailAd: (String zoneId){
print("interstitial onFailAd");
}
);
});
....//Interstitial Load
interstitial.load();
....//Interstitial Show
interstitial.isLoaded().then((value){
if(value){
interstitial.show();
}
});
2.3) Reward AD
The following is an example of requesting a Reward ad.
....//Reward init
FlutterBidmadCommon common = FlutterBidmadCommon();
FlutterBaseReward reward;
common.initRewardChannel().then((value) {
String _channelNm = value;
reward = FlutterBaseReward(
channelName: _channelNm
);
reward.setAdInfo("Your Zone Id");
reward.setCallbackListener(
onLoadAd: (String zoneId){
print("reward onLoadAd");
},
onShowAd: (String zoneId){
print("reward onShowAd");
reward.load();
},
onCompleteAd: (String zoneId){
print("reward onCompleteAd");
},
onSkipAd: (String zoneId){
print("reward onSkippedAd");
},
onCloseAd: (String zoneId){
print("reward onCloseAd");
},
onClickAd: (String zoneId){
print("reward onClickAd");
},
onFailAd: (String zoneId){
print("reward onFailAd");
}
);
});
....//Reward Load
reward.load();
....//Reward Show
reward.isLoaded().then((value){
if(value){
reward.show();
}
});
3. Plugin Interface #
3.1 FlutterBaseBanner
*Banner ads are handled through FlutterBaseBanner and this is a list of functions for that.
Function | Description |
---|---|
FlutterBaseBanner(@required String channelName) | This is the FlutterBaseBanner constructor, Receives the Name for Channel creation as a Param. |
Future(void) load(int y) | Request a banner ad. When a banner ad is exposed, the banner is exposed at height y (center alignment). |
Future(void) setInterval(int sec) | Set the banner refresh cycle.(60s~120s) |
Future(void) setAdInfo(String zoneId) | Set the issued ZoneId. |
Future(void) hideBanner() | Hide the banner View |
Future(void) showBanner() | Show the banner View. |
Future(void) removeBanner() | Remove the exposed banner. |
void Function(String zoneId) onLoadAd | If a listener is registered, the registered function is called when ad load. |
void Function(String zoneId) onFailAd | If a listener is registered, the registered function is called when ad load fail. |
3.2 FlutterBaseInterstitial
*Interstitial ads are handled through FlutterBaseInterstitial and this is a list of functions for that.
Function | Description |
---|---|
FlutterBaseInterstitial(@required String channelName) | This is the FlutterBaseInterstitial constructor, Receives the Name for Channel creation as a Param. |
Future(void) load() | Request a interstitial ad |
Future(void) show() | Display the loaded interstitial ad |
Future(bool) isLoaded() | Check if the ad is loaded. |
Future(void) setAdInfo(String zoneId) | Set the issued ZoneId. |
void Function(String zoneId) onLoadAd | If a listener is registered, the registered function is called when ad load. |
void Function(String zoneId) onShowAd | If a listener is registered, the registered function is called when ad show. |
void Function(String zoneId) onFailAd | If a listener is registered, the registered function is called when ad load fail. |
void Function(String zoneId) onCloseAd | If a listener is registered, the registered function is called when ad close. |
3.3 FlutterBaseReward
*Reward ads are handled through FlutterBaseReward and this is a list of functions for that.
Function | Description |
---|---|
FlutterBaseReward(@required String channelName) | This is the FlutterBaseReward constructor, Receives the Name for Channel creation as a Param. |
Future(void) load() | Request a reward ad. |
Future(void) show() | Display the loaded reward ad. |
Future(bool) isLoaded() | Check if the ad is loaded. |
Future(void) setAdInfo(String zoneId) | Set the issued ZoneId. |
void Function(String zoneId) onLoadAd | If a listener is registered, the registered function is called when ad load. |
void Function(String zoneId) onShowAd | If a listener is registered, the registered function is called when ad show. |
void Function(String zoneId) onFailAd | If a listener is registered, the registered function is called when ad load fail. |
void Function(String zoneId) onCompleteAd | If a listener is registered, the registered function is called when ad complate. |
void Function(String zoneId) onCloseAd | If a listener is registered, the registered function is called when ad close. |
void Function(String zoneId) onClickAd | If a listener is registered, the registered function is called when ad click. |
void Function(String zoneId) onSkipAd | If a listener is registered, the registered function is called when ad skip. |
3.4 FlutterBidmadCommon
*This is a list of functions available through BidmadCommon.
Function | Description |
---|---|
FlutterBidmadCommon() | This is the FlutterBidmadCommon constructor |
Future(void) setDebugging(bool isDebug) | Debugging log output |
Future(String) initBannerChannel() | Creating a channel for controlling banner ad |
Future(String) initInterstitialChannel() | Creating a channel for controlling interstitial ad |
Future(String) initRewardChannel() | Creating a channel for controlling reward ad |