<<<<<<< HEAD
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? Use the template at the bottom!
- Create or upload files
- Add files using the command line or push an existing Git repository with the following command:
cd existing_repo
git remote add origin https://gitlab.rocketstudio.com.vn/skyapps/baseproject/android-ads.git
git branch -M main
git push -uf origin main
- Invite team members and collaborators
- Create a new merge request
- Automatically close issues from merge requests
- Enable merge request approvals
- Automatically merge when pipeline succeeds
Use the built-in continuous integration in GitLab.
- Get started with GitLab CI/CD
- Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)
- Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy
- Use pull-based deployments for improved Kubernetes management
- Set up protected environments
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to makeareadme.com for this template.
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
Choose a self-explaining name for your project.
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
If you have ideas for releases in the future, it is a good idea to list them in the README.
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
Show your appreciation to those who have contributed to the project.
For open source projects, say how it is licensed.
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
- Admob
- MAX Mediation(Applovin)
- Google Billing
- Adjust
- Appsflyer
- Firebase auto log tracking event, tROAS
// Init IS trong SplashActivity
String keyIS = "85460dcd" (Key Test)
AppIronSource.getInstance().init(TestSplash.this, keyIS , true);
// Load Inter Splash
AppIronSource.getInstance().loadSplashInterstitial(this, new AdCallback() {
@Override
public void onNextAction() {
super.onNextAction();
startActivity(new Intent(this, MainActivity.class));
}
}, 30000);
// Load Banner
AppIronSource.getInstance().loadBanner(this);
// Load Inter
if(!AppIronSource.getInstance().isInterstitialReady()){
AppIronSource.getInstance().loadInterstitial(this, new AdCallback());
}
// Show Inter
if(AppIronSource.getInstance().isInterstitialReady()){
AppIronSource.getInstance().showInterstitial(this, new AdCallback(){
@Override
public void onNextAction() {
super.onNextAction();
startActivity(new Intent(this, MainActivity.class));
}
});
}else{
startActivity(new Intent(this, MainActivity.class));
}
AdjustConfig adjustConfig = new AdjustConfig(true, ADJUST_TOKEN);
RKAdConfig.setAdjustConfig(adjustConfig);
maven { url 'https://jitpack.io' }
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.google.android.gms:play-services-ads:22.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
maven {url 'https://android-sdk.is.com/'}
maven {url 'https://artifact.bytedance.com/repository/pangle/'}
maven {url 'https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea'}
// Mediation
implementation 'com.google.ads.mediation:applovin:11.8.2.0'
implementation 'com.google.ads.mediation:pangle:5.0.1.0.0'
implementation 'com.google.ads.mediation:facebook:6.13.7.0'
implementation 'com.google.ads.mediation:ironsource:7.3.0.0'
implementation 'com.unity3d.ads:unity-ads:4.6.0'
implementation 'com.google.ads.mediation:unity:4.6.1.0'
implementation 'com.google.ads.mediation:vungle:6.12.1.0'
implementation 'com.google.ads.mediation:mintegral:16.4.21.0'
// Setup trong MyApplication
MBridgeSDK sdk = MBridgeSDKFactory.getMBridgeSDK();
sdk.setConsentStatus(this, MBridgeConstans.IS_SWITCH_ON);
Admob.getInstance().setAppLovin(true)
Admob.getInstance().setColony(true)
Admob.getInstance().setFan(true)
Admob.getInstance().setVungle(true)
We recommend you to setup 2 environments for your project, and only use test id during development, ids from your admob only use when needed and for publishing to Google Store
- The name must be the same as the name of the marketing request
- Config variant test and release in gradle
- appDev: using id admob test while dev
- appProd: use ids from your admob, build release (build file .aab)
productFlavors {
appDev {
manifestPlaceholders = [ad_app_id: "ca-app-pub-3940256099942544~3347511713"]
buildConfigField "String", "inter", "\"ca-app-pub-3940256099942544/1033173712\""
buildConfigField "String", "banner", "\"ca-app-pub-3940256099942544/6300978111\""
buildConfigField "String", "native", "\"ca-app-pub-3940256099942544/2247696110\""
buildConfigField "String", "open_resume", "\"ca-app-pub-3940256099942544/3419835294\""
buildConfigField "String", "RewardedAd", "\"ca-app-pub-3940256099942544/5224354917\""
buildConfigField "Boolean", "build_debug", "true"
}
appProd {
// ADS CONFIG BEGIN (required)
manifestPlaceholders = [ad_app_id: "ca-app-pub-3940256099942544~3347511713"]
buildConfigField "String", "inter", "\"ca-app-pub-3940256099942544/1033173712\""
buildConfigField "String", "banner", "\"ca-app-pub-3940256099942544/6300978111\""
buildConfigField "String", "native", "\"ca-app-pub-3940256099942544/2247696110\""
buildConfigField "String", "open_resume", "\"ca-app-pub-3940256099942544/3419835294\""
buildConfigField "String", "RewardedAd", "\"ca-app-pub-3940256099942544/5224354917\""
buildConfigField "Boolean", "build_debug", "false"
// ADS CONFIG END (required)
}
}
AndroidManiafest.xml
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="${ad_app_id}" />
// Config SDK Facebook
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="@string/facebook_client_token" />
<meta-data android:name="com.facebook.sdk.AutoInitEnabled"
android:value="true"/>
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="true"/>
<meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
android:value="true"/>
Create class Application
Configure your mediation here. using PROVIDER_ADMOB or PROVIDER_MAX
*** Note:Cannot use id ad test for production enviroment
class App extends AdsMultiDexApplication(){
@Override
public void onCreate() {
super.onCreate();
...
String environment = BuildConfig.build_debug ? RKAdConfig.ENVIRONMENT_DEVELOP : RKAdConfig.ENVIRONMENT_PRODUCTION;
RKAdConfig = new RKAdConfig(this, RKAdConfig.PROVIDER_ADMOB, environment);
// Optional: setup Adjust event
AdjustConfig adjustConfig = new AdjustConfig(true,ADJUST_TOKEN);
// adjustConfig.setEventAdImpression(EVENT_AD_IMPRESSION_ADJUST);
// adjustConfig.setEventNamePurchase(EVENT_PURCHASE_ADJUST);
RKAdConfig.setAdjustConfig(adjustConfig);
// Optional: setup Appsflyer event
AppsflyerConfig appsflyerConfig = new AppsflyerConfig(true,APPSFLYER_TOKEN);
RKAdConfig.setAppsflyerConfig(appsflyerConfig);
// Optional: setup client token SDK Facebook
RKAdConfig.setFacebookClientToken(FACEBOOK_CLIENT_TOKEN)
// Optional: enable ads resume
RKAdConfig.setIdAdResume(BuildConfig.ads_open_app);
// Optional: setup list device test - recommended to use
listTestDevice.add(DEVICE_ID_TEST);
RKAdConfig.setListDeviceTest(listTestDevice);
RKAd.getInstance().init(this, RKAdConfig, false);
// Auto disable ad resume after user click ads and back to app
Admob.getInstance().setDisableAdResumeWhenClickAds(true);
// If true -> onNextAction() is called right after Ad Interstitial showed
Admob.getInstance().setOpenActivityAfterShowInterAds(true);
AppOpenManager.getInstance().disableAppResumeWithActivity(SplashActivity.class);
}
}
AndroidManiafest.xml
<application
android:name=".App"
...
>
SplashActivity
RKAdCallback adCallback = new RKAdCallback() {
@Override
public void onNextAction() {
super.onNextAction();
Log.d(TAG, "onNextAction");
startMain();
}
};
RKAd.getInstance().setInitCallback(new RKInitCallback() {
@Override
public void initAdSuccess() {
RKAd.getInstance().loadSplashInterstitialAds(SplashActivity.this, idAdSplash, TIME_OUT, TIME_DELAY_SHOW_AD, true, adCallback);
}
});
SplashActivity
AppOpenManager.getInstance().loadSplashOpenAndInter(SplashActivity.class,SplashActivity.this, BuildConfig.open_lunch_high,BuildConfig.inter_splash,25000, new AdCallback(){
@Override
public void onNextAction() {
super.onNextAction();
// startMain();
}
});
Load ad interstital before show Check null when Load Inter
private fun loadInterCreate() {
ApInterstitialAd mInterstitialAd = RKAd.getInstance().getInterstitialAds(this, idInter);
}
Show and auto release ad interstitial
if (mInterstitialAd.isReady()) {
RKAd.getInstance().forceShowInterstitial(this, mInterstitialAd, new RKAdCallback() {
@Override
public void onNextAction() {
super.onNextAction();
Log.d(TAG, "onNextAction");
startActivity(new Intent(MainActivity.this, MaxSimpleListActivity.class));
}
}, true);
} else {
loadAdInterstitial();
}
<com.ads.control.ads.bannerAds.RKBannerAdView
android:id="@+id/bannerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:layout_constraintBottom_toBottomOf="parent" />
call load ad banner
bannerAdView.loadBanner(this, idBanner);
<include
android:id="@+id/include"
layout="@layout/layout_banner_control"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:layout_constraintBottom_toBottomOf="parent" />
call load ad banner
RKAd.getInstance().loadBanner(this, idBanner);
Load ad native before show
RKAd.getInstance().loadNativeAdResultCallback(this,ID_NATIVE_AD, com.ads.control.R.layout.custom_native_max_small,new RKAdCallback(){
@Override
public void onNativeAdLoaded(@NonNull ApNativeAd nativeAd) {
super.onNativeAdLoaded(nativeAd);
//save or show native
}
});
Populate native ad to view
RKAd.getInstance().populateNativeAdView(MainApplovinActivity.this,nativeAd,flParentNative,shimmerFrameLayout);
auto load and show native contains loading
in layout XML
<com.ads.control.ads.nativeAds.RKNativeAdView
android:id="@+id/RKNativeAds"
android:layout_width="match_parent"
android:layout_height="@dimen/_150sdp"
android:background="@drawable/bg_card_ads"
app:layoutCustomNativeAd="@layout/custom_native_admod_medium_rate"
app:layoutLoading="@layout/loading_native_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Call load native ad
RKNativeAdView.loadNativeAd(this, idNative);
Load Ad native for recyclerView
// ad native repeating interval
RKAdAdapter adAdapter = RKAd.getInstance().getNativeRepeatAdapter(this, idNative, layoutCustomNative, com.ads.control.R.layout.layout_native_medium,
originalAdapter, listener, 4);
// ad native fixed in position
RKAdAdapter adAdapter = RKAd.getInstance().getNativeFixedPositionAdapter(this, idNative, layoutCustomNative, com.ads.control.R.layout.layout_native_medium,
originalAdapter, listener, 4);
recyclerView.setAdapter(adAdapter.getAdapter());
adAdapter.loadAds();
Get and show reward
ApRewardAd rewardAd = RKAd.getInstance().getRewardAd(this, idAdReward);
if (rewardAd != null && rewardAd.isReady()) {
RKAd.getInstance().forceShowRewardAd(this, rewardAd, new RKAdCallback());
}
});
App
override fun onCreate() {
super.onCreate()
AppOpenManager.getInstance().enableAppResume()
RKAdConfig.setIdAdResume(AppOpenManager.AD_UNIT_ID_TEST);
...
}
Application
@Override
public void onCreate() {
super.onCreate();
AppPurchase.getInstance().initBilling(this,listINAPId,listSubsId);
}
if (AppPurchase.getInstance().getInitBillingFinish()){
loadAdsPlash();
}else {
AppPurchase.getInstance().setBillingListener(new BillingListener() {
@Override
public void onInitBillingListener(int code) {
loadAdsPlash();
}
},7000);
}
//check purchase with PRODUCT_ID
AppPurchase.getInstance().isPurchased(this,PRODUCT_ID);
//check purchase all
AppPurchase.getInstance().isPurchased(this);
AppPurchase.getInstance().purchase(this,PRODUCT_ID);
AppPurchase.getInstance().subscribe(this,SUBS_ID);
AppPurchase.getInstance().setPurchaseListioner(new PurchaseListioner() {
@Override
public void onProductPurchased(String productId,String transactionDetails) {
}
@Override
public void displayErrorMessage(String errorMsg) {
}
});
AppPurchase.getInstance().getIdPurchased();
AppPurchase.getInstance().consumePurchase(PRODUCT_ID);
AppPurchase.getInstance().getPrice(PRODUCT_ID)
AppPurchase.getInstance().getPriceSub(SUBS_ID)
InAppDialog dialog = new InAppDialog(this);
dialog.setCallback(() -> {
AppPurchase.getInstance().purchase(this,PRODUCT_ID);
dialog.dismiss();
});
dialog.show();
To ignore invalid ads traffic https://support.google.com/adsense/answer/16737?hl=en
To ignore accident click from user. This feature is existed in library
To ignore infinite loop
19b65089f2c600b36537530964652da1e269845b