How To Integrate Apps Manager System To Your App
How To Integrate Apps Manager System To Your App
Get Started
This guide is for publishers who want to monetize an Android app with Apps
Manager system.
Integrating the Apps Manager AdsSdk Module into an app is the first step toward displaying
ads with various platform which is managed remotely for better app management and
earning revenue. Once you've integrated the Module, you can display or control an ad
remotely and follow the steps to implement it.
Prerequisites
Use Android Studio 3.2 or higher
minSdkVersion 16 or higher
compileSdkVersion 28 or higher
}
}
Next, open the app-level build.gradle file for your app, and look for a "dependencies"
section.
Update app-level build.gradle
android {
defaultConfig {
...
minSdkVersion 16
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation project(path: ':AdsSdk')
}
Add the line in bold above, in which enable multiDex true and implements module to
dependencies section. Once that's done, save the file and perform a Gradle sync.
Note: If you face any problem while import module then create a new module and paste all
the code of AdsSdk into your module.
After successfully adding AdsSdk module to your App, you need to follow
step for ad placement shown in demo app
(Extends your launcher activity with ADS_SplashActivity and paste code as shown in below
example from your ad integration demo provided by Apps Manager)
package ----;
import com.pesonal.adsdk.ADS_SplashActivity;
import com.pesonal.adsdk.BuildConfig;
import com.pesonal.adsdk.getDataListner;
import org.json.JSONObject;
import java.util.Arrays;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().setFlags(1024, 1024);
setContentView(R.layout.activity_splash);
@Override
public void onUpdate(String url) {
@Override
public void onRedirect(String url) {
@Override
public void onReload() {
Note : You can get complete source code of showUpdateDialog(), showRedirectDialog() and
getCurrentVersionCode() from Ad Implementation Demo provided by Apps Manager.
Select an ad format
The Mobile Ads SDK is now imported and you're ready to implement an ad. AdMob offers a
number of different ad formats, so you can choose the one that best fits your app's user
experience.
Interstitial
Full-screen ads that cover the interface of an app until closed by the user. They're best used
at natural pauses in the flow of an app's execution, such as between levels of a game or just
after a task is completed.
Load an Ad
package ...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppManage.getInstance(MainActivity.this).loadInterstitialAd(this,ADMOB_I1,FACEBOOK_I1);
}
}
Note : Here ADMOB_I1 and FACEBOOK_I1 is interstitial ad id come from server. Here both
ads are load at same time. If you want to load and display single ad then other ad id
parameter will be blank.
While you load ad in every activity, then remove loadAd() from displayInterstitialAd()
in AppManage.java .
Example :
For Admob remove line
interstitial1.loadAd(new AdRequest.Builder().build());
Show the Ad
btn_Interstitial.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AppManage.getInstance(MainActivity.this).showInterstitialAd(MainActivity.this, new
AppManage.MyCallback() {
public void callbackCall() {
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);
}
},"",AppManage.app_mainClickCntSwAd);
}
});
Note : If user want too integrate ad based on number of click then developer have option to
use app_mainClickCntSwAd and app_innerClickCntSwAd which is managed remotely.
Here in callbackcall() first parameter is blank which indicates that ad will be displayed
randomly setted from Apps Manager System which means in this button any platform ad
will be display as per sequence or in alertnate manner.
Here if you want to display specific ad then pass ad platform like AppManage.FACEBOOK or
AppManage.ADMOB or anyother as per your need.
btn_Interstitial.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AppManage.getInstance(MainActivity.this).showInterstitialAd(MainActivity.this, new
AppManage.MyCallback() {
public void callbackCall() {
Native
Load & Show an Ad
Here developer have very easy & common method for load and show native ad from any
platform.
For load and display native ad, developer need to pass contatiner and id of ad platform. If
you want to display native ad with specific platform then pass empty parameter to
showNative().
package ---;
import androidx.appcompat.app.AppCompatActivity;
import static com.pesonal.adsdk.AppManage.ADMOB_N1;
import static com.pesonal.adsdk.AppManage.FACEBOOK_N1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppManage.getInstance(MainActivity.this).showNative((ViewGroup)
findViewById(R.id.native_container), ADMOB_N1, FACEBOOK_N1);
}
Note : Here ADMOB_N1 and FACEBOOK_N1 is native ad id come from server. Here both ads
are not load at same time but whether one ad is failed to load then Apps Manager
automatically go with other platform ad. If you want to load and display single ad then
other ad id parameter will be blank.
AppManage.getInstance(MainActivity.this).showNative((ViewGroup)
findViewById(R.id. native_container), "", FACEBOOK_N1);
native_container is container for native ad. Here developer needs to pass XML
container as per own requirement.
Example:
<LinearLayout
android:id="@+id/native_container"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginBottom="@dimen/_10sdp"
android:orientation="vertical" />
Banner
Load & Show an Ad
Here developer have very easy & common method for load and show banner ad from any
platform.
For load and display banner ad, developer need to pass contatiner and id of ad platform. If
you want to display banner ad with specific platform then pass empty parameter to
showBanner().
Example:
package ---;
import androidx.appcompat.app.AppCompatActivity;
import static com.pesonal.adsdk.AppManage.ADMOB_B1;
import static com.pesonal.adsdk.AppManage.FACEBOOK_B1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppManage.getInstance(MainActivity.this).showBanner((ViewGroup)
findViewById(R.id.banner_container), ADMOB_B1, FACEBOOK_B1);
}
Note : Here ADMOB_B1 and FACEBOOK_B1 is banner ad id come from server. Here both
ads are not load at same time but whether one ad is failed to load then Apps Manager
automatically go with other platform ad. If you want to load and display single ad then
other ad id parameter will be blank as shown below.
AppManage.getInstance(MainActivity.this). ((ViewGroup)
findViewById(R.id.banner_container), "", FACEBOOK_B1);
banner_container is container for banner ad. Here developer needs to pass XML
container as per own requirement.
Example:
<LinearLayout
android:id="@+id/banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_10sdp"
android:layout_alignParentBottom="true"
android:orientation="vertical" />
Native Banner
Load & Show an Ad
Here developer have very easy & common method for load and show native banner ad
from any platform.
For load and display banner ad, developer need to pass contatiner and id of ad platform. If
you want to display native banner ad with specific platform then pass empty parameter to
show_NATIVEBANNER().
Example:
package ---;
import androidx.appcompat.app.AppCompatActivity;
import static com.pesonal.adsdk.AppManage.ADMOB_B1;
import static com.pesonal.adsdk.AppManage.FACEBOOK_NB1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppManage.getInstance(MainActivity.this).showNativeBanner((ViewGroup)
findViewById(R.id.banner_container), ADMOB_B1, FACEBOOK_NB1);
}
Note : Native banner is only for facebook so here ADMOB_B1 is banner ad id and
FACEBOOK_NB1 is native banner ad id come from server. Here both ads are not load at
same time but whether one ad is failed to load then Apps Manager automatically go with
other platform ad. If you want to load and display single ad then other ad id parameter will
be blank as shown below.
AppManage.getInstance(MainActivity.this).showNativeBanner((ViewGroup)
findViewById(R.id.banner_container), "", FACEBOOK_NB1);
banner_container is container for banner ad. Here developer needs to pass XML
container as per own requirement.
Example:
<LinearLayout
android:id="@+id/banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_10sdp"
android:layout_alignParentBottom="true"
android:orientation="vertical" />
Rewarded Ads
Load & Show an Ad
Here, predefined coding of rewarded ads is not come with AdsSdk because in many case all
application is not use with rewarded ads. Developer needs to use rewarded ad as per own
requirments. Apps Manager provides only ad id of rewarded ads which is come from server
Native in AdsSdk
For adding or removing any native ad displayNative() from AppManage.java in AdsSdk is
responsible. Based on existing coding please add or remove any ad platform after proper
refer.
Here in showNative() first load native ad and then same function is work for display ad
after successful ad load. So call showNative() for both task as load and show as per
requirments.
Banner in AdsSdk
For adding or removing any banner ad displayBanner() from AppManage.java in AdsSdk is
responsible. Based on existing coding please add or remove any ad platform after proper
refer.
Here in showBanner() first load banner ad and then same function is work for display ad
after successful ad load. So call showBanner() for both task as load and show as per
requirments.