0% found this document useful (0 votes)
81 views

How To Integrate Apps Manager System To Your App

This document provides instructions for integrating an Apps Manager system to manage ads and monetization in an Android app. It describes importing the Apps Manager Ads SDK module, setting it up in the app-level build.gradle file, initializing the SDK, and loading and displaying different ad formats like interstitial, native and banner ads. Developers can integrate different ad platforms and the system will handle displaying the most appropriate ad based on availability and settings managed remotely through the Apps Manager.

Uploaded by

Kes Bha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

How To Integrate Apps Manager System To Your App

This document provides instructions for integrating an Apps Manager system to manage ads and monetization in an Android app. It describes importing the Apps Manager Ads SDK module, setting it up in the app-level build.gradle file, initializing the SDK, and loading and displaying different ad formats like interstitial, native and banner ads. Developers can integrate different ad platforms and the system will handle displaying the most appropriate ad based on availability and settings managed remotely through the Apps Manager.

Uploaded by

Kes Bha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

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

Android Side Setup:

Import Apps Manager AdsSdk as module to your App


(Note: Open Android Studio->File->New->Import Module)
Set AdsSdk path and click finish
(Note: make sure if you use Unity platform for ad then you need to import AdsSdk with
unity-ads module also otherwise you need only AdsSdk for ad setup)

Update project-level build.gradle


allprojects{
repositories {
google()
jcenter()
maven{ url 'https://jitpack.io' }

/* maven {url "http://dl.appnext.com/"} in case if you use


Appnext platform */

}
}

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

Initialize the Mobile AdsSdk

Extends your SplashActivity with ADS_SplashActivity


Before loading ads, have your app initialize the Mobile Ads SDK by calling ADSinit() which
initializes the SDK and calls back a completion listener once initialization is complete (or
after a 30-second timeout). This needs to be done only once, ideally at app launch.

(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;

public class SplashActivity extends ADS_SplashActivity {

@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);

ADSinit(SplashActivity.this, getCurrentVersionCode(), new


getDataListner() {
@Override
public void onSuccess() {

//Call after Successfull responce from server


// After response you can navigate your activity from splash
to other
startActivity(new Intent(SplashActivity.this,
MainActivity.class));
finish();
}

@Override
public void onUpdate(String url) {

//Show Version update dialog which is manage remotely


showUpdateDialog(url);
}

@Override
public void onRedirect(String url) {

//Show redirect dialog which is manage remotely


showRedirectDialog(url);
}

@Override
public void onReload() {

//Reload activity in case of internet failure


startActivity(new Intent(SplashActivity.this,
SplashActivity.class));
finish();
}
@Override
public void onGetExtradata(JSONObject extraData) {

// Get any extra data send from server


}
});

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 ...

import static com.pesonal.adsdk.AppManage.ADMOB_I1;


import static com.pesonal.adsdk.AppManage.FACEBOOK_I1;
public class MainActivity extends Activity {

@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.

One time ad load


If you use single ad id in full application then, you need to load an ad one time only after
getting successful response. In this case, if admob is failed to load or display then facebook
will automatically display in place of admob.
Here, if admob is failed to load ad, then admob try to load ad again and Apps Manager go
for the next ad platform sequence which is ready to show ad decided from server.

Actvity wise ad load


If you use multiple ad id or want to load ad everytime before show, then you need to call
loadInterstitialAd() in every onCreate() of each activity.

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());

For Facebook remove line


fbinterstitialAd1.loadAd();

For AppNext remove line


appnextinterstitialAd.showAd();

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);

//app_mainClickCntSwAd is set from server, if not set then default value is 1


//app_innerClickCntSwAd is set from server, if not set then default value is 1

}
});

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() {

Toast.makeText(MainActivity.this,"Perform any operation after


ad",Toast.LENGTH_SHORT).show();
}
},AppManage.ADMOB,AppManage.app_mainClickCntSwAd);
}
});

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;

public class MainActivity extends AppCompatActivity {

@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;

public class MainActivity extends AppCompatActivity {

@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;

public class MainActivity extends AppCompatActivity {

@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

How to customize AdsSdk


AppManage class contains all settings of AdsSdk related settings. Make sure not to
change anything into SDK otherwise its not work properly.
If developer needs to update or change anything in AdsSdk, then App Manage class is
responsible for settings and response which is come from server. Whenever any ad class or
coding is change in that case developer can easily change all things with own way.
Make sure before and after add or remove any ad network, please refer exisiting ad
network coding and based on that you can add or remove ad network.
Interstitial in AdsSdk
For adding or removing any interstitial ad loadInterstitialads() from AppManage.java in
AdsSdk is responsible. Based on existing coding please add or remove any ad platform.
loadInterstitialads() loads interstitial ad of various platform.

For display ad, turnInterstitialAd() and displayInterstitialAd() from AppManage.java in


AdsSdk is responsible. Make sure before change anything refer other code which work
perfectly and then based on that make any changes.

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.

Native Banner in AdsSdk


For adding or removing native banner ad displayNativeBanner() from AppManage.java in
AdsSdk is responsible. Based on existing coding please add or remove any ad platform after
proper refer.
Here in showNativeBanner() first load native banner ad and then same function is work for
display ad after successful ad load. So call showNativeBanner() for both task as load and
show as per requirments.

You might also like