Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infyomlabs/ads-sdk
https://github.com/infyomlabs/ads-sdk
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/infyomlabs/ads-sdk
- Owner: InfyOmLabs
- Created: 2022-11-25T07:44:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T09:19:33.000Z (9 months ago)
- Last Synced: 2024-10-29T21:05:28.505Z (3 months ago)
- Language: Java
- Size: 15.6 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# ads-sdk
To get a Git project into your build:
[![](https://jitpack.io/v/InfyOmLabs/ads-sdk.svg)](https://jitpack.io/#InfyOmLabs/ads-sdk)Step 1. Add the JitPack repository to your build file
========= Features ==========
==> For Banner, Interstitial, and Native ads, you can use multiple ad IDs;
==> You can set interstitial ads to appear periodically.
========= Gradle ==========
1). Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
2). Add the dependency
==> FOR SIMPLE ADSimplementation 'com.github.InfyOmLabs:ads-sdk:1.7.8'
==> Pre Interstitital Ads// 1 = admob id
@Override
protected void onResume() {
InfyOmAds.loadPreInterstitial(1,this);
super.onResume();
}
===> FOR BANNER IN APPLICATION CLASSpublic class MyApplication extends Application implements ActivityLifecycleCallbacks {
private Activity currentActivity;
@Override
public void onCreate() {
super.onCreate();
this.registerActivityLifecycleCallbacks(this);}
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
currentActivity = activity;
}@Override
public void onActivityStarted(@NonNull Activity activity) {}@Override
public void onActivityResumed(@NonNull Activity activity) {
AdBanner.resumeAdView();}
@Override
public void onActivityPaused(@NonNull Activity activity) {
if (AdBanner.getCurrentActivity() != null && (AdBanner.getCurrentActivity() == currentActivity)) {
AdBanner.pauseAdView();
}
}@Override
public void onActivityStopped(@NonNull Activity activity) {
}@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
}@Override
public void onActivityDestroyed(@NonNull Activity activity) {
if (AdBanner.getCurrentActivity() != null && (AdBanner.getCurrentActivity() == currentActivity)) {
AdBanner.destroyAdView();
}
}}
===== color guide ======
<------------ set color in theme --------------->Progressbar color ------> colorPrimary
Button and Space -------> tabSelectedTextColor3). use below code in activity
Button showAds;
RelativeLayout rlBanner,rl_native;
View tv_space;showAds = findViewById(R.id.btn_next);
rlBanner = findViewById(com.infyom.adssdk.R.id.rl_banner);
rl_native = findViewById(com.infyom.adssdk.R.id.rl_native);
tv_space = findViewById(com.infyom.adssdk.R.id.tv_space);InfyOmAds.initializeAds(this); // Once Application
InfyOmAds.enableTestMode(this); // OnceInfyOmAds.initDefaultValue(); // Once Splash
InfyOmAds.showBanner(this,rlBanner,1);
InfyOmAds.showNative(this,rl_native,tv_space,1, InfyOmAds.AdTemplate.NATIVE_300);showAds.setOnClickListener(v -> {
InfyOmAds.showInterstitial(1, this, new Interstitial() {
@Override
public void onAdClose(boolean isFail) {
startActivity(new Intent(MainActivity.this,Main2Activity.class));
}
});
});
======= Native Templates ===============
InfyOmAds.AdTemplate.NATIVE_350,
InfyOmAds.AdTemplate.NATIVE_300,
InfyOmAds.AdTemplate.NATIVE_150,
InfyOmAds.AdTemplate.NATIVE_100,
InfyOmAds.AdTemplate.NATIVE_50,
InfyOmAds.AdTemplate.NATIVE_40