Keymob
Keymob is a lib used to manage ads in ios and android app similar with adwhirl,just config ads platform in json file.Support admob, chartboost, inmobi.mmedia, amazon, iad now,and will add support for mopub,mobfox,Adcolony,Vungle,TapJoy,Playhaven,Revmob,flurry ad,Unity Ads,keymob android
Install / Use
/learn @keymobdev/KeymobREADME
Keymob is a simple lib to manage ad
Keymob can be very easy to use management various advertising platforms in application, including which platform ad impressions, the proportion of each platform, setting priorities.<br/> Support admob, chartboost, inmobi.mmedia, amazon, iad, baidu and other common advertising platform, more platforms will been supported.<br/> Support rich forms of advertising, including the popular banner a variety of sizes, rect ads, Interstitial ads, video ads, More APP Ad.<br/> Ad config can been managed in www.keymob.com , modify and adjust easy, you can config keymob with json format file , and then put it in the project or on the website.<br/>
Usage
1. Download and install the library files<br/>
To show ads on mobile application which needs to add advertisement library in the application, the current version Keymob library is 20170201. You can find it is a android demo project , the following resources are Keymob library-related. <br/>
- libs\keymobad.jar keymob core libraries<br/>
- assets\com_keymob_sdks keymob backup platform<br/>
- assets\bdxadsdk.jar keymob Baidu platform required resource<br/>
- assets\gdt_plugin gdt_plugin keymob gdt platform required resource<br/>
- README.md keymob English quickly integrate document<br/>
- README_zh.md keymob Chinese quickly integrate document<br/>
<br/> Note: The three documents in assets directory can not be modified file name .<br/> AdmobAdapter.jar in com_keymob_sdks indicates admob is used as a backup platform when can not connect Keymob. If you want to switch to other platforms you can download from https://github.com/keymobdev/admob-adapter
2.Add Code
a.add import<br/>
import com.keymob.networks.AdManager;
import com.keymob.networks.core.*;
import com.keymob.sdk.core.AdTypes;
Before using keymob, first import keymob related class files. Most of the core classes in com.keymob.core package, so you can import all at once. AdManager as the main class of keymob , also need to be imported.<br/>
b.Setup and initialize keymob with json string
AdManager.getInstance().initFromJSON(active,jsonString,new AdEventListener());
The first parameter is context active, it as necessary, and can not be null.<br/> The second parameter is the config info of each platform in json string format,json format reference template.<br/> The third parameter is event listener of advertising,witch is a class that implements interface IAdEventListener, if you do not want to deal with advertising events, you can set it to null.<br/>
Or You can Setup and initialize keymob with Keymob.com service,that will been more easy to use.and not need json config file.
AdManager.getInstance().initFromKeymobService(this, "1", new AdEventListener(), false);
The first parameter is context active, it as necessary, and can not be null. The second parameter is ID got from Keymob.com The third parameter is event listener of advertising,witch is a class that implements interface IAdEventListener, if you do not want to deal with advertising events, you can set it to null.<br/> The fourth parameter is test mode switch,if you are testing ad set true,change to false when publish
Tip: ID can be got from www.keymob.com .
c. Display banner advertising
AdManager.getInstance().showRelationBanner(BannerSizeType.BANNER, BannerPositions.BOTTOM_CENTER,80,this);
The above means that displays the standard banner ad at the bottom of the device . The first parameter is the ad size, the type size can be selected in BannerSizeType constants, including the standard banner, rectange banner, smart banner and so on.<br/>
Other banner size outside standard size(320*50) may have small differences in the different platforms, run to see the effects.<br/> The second parameter is the position of the banner displayed, the value of each position is in BannerPositions constants,including the top left, top center, top right-hand and so on ,9 kinds of common position total.<br/> The third parameter is offsetY, i.e., the relative positional deviation, e.g., on the bottom of the application, the upward offset 80 pixels, that is, the effect of the above code. If you want to stick to the bottom of the application, set the offsetY 0.<br/>
d. display banner at Fixed location
AdManager.getInstance().showBannerABS(BannerSizeType.BANNER, 0, 200,this);
The above code is display standard banner at point(0,200)<br/> Although the relative positioning to meet the needs of the majority of advertising location settings, but to meet the needs of some special position, keymob provides absolute fixed position display banner advertising api.<br/> The first parameter is the size of the banner, the second argument and third parameters are the position x and y values of banner.<br/>
e. Hide banne ad
AdManager.getInstance().removeBanner();
"removeBanner" hidden banner advertising, but advertising will not be destroyed so show can be quickly presented to the user next time. Some advertising platform will continue to load ad after hidden , so the event will dispatched also.<br/>
f. Load and display full-screen ads
AdManager.getInstance().loadInterstitial(this);
Load Interstitial ads, does not automatically show after load successfully, this can better control Interstitial ad at the right time to show to the user,<br/> If you want to show immediate after load,just handler onLoadedSuccess in eventListener and call showInterstitial.<br/>
AdManager.getInstance().showInterstitial(this);
Display Interstitial advertising, ads will appear immediately after the call showInterstitial. However, please ensure that advertising has finished loading.
AdManager.getInstance().isInterstitialReady();
Check the Interstitial ad is loaded complete. If call showInterstitial directly when an ad has not finished loading unpredictable events will occur, som advertising platform could lead to crash.<br/> So make sure the Interstitial is ready before every show.Below is the overall look.
if(AdManager.getInstance().isInterstitialReady()){
AdManager.getInstance().showInterstitial(this);
}
g. Load and display video ads
AdManager.getInstance().loadVideo(this);
Load video ads, does not automatically show after load successfully, this can better control video ad at the right time to show to the user,<br/> If you want to show immediate after load,just handler onLoadedSuccess in eventListener and call showVideo.
AdManager.getInstance().showVideo();
Display video ads, ads will appear immediately after the call showVideo. However, please ensure that advertising has finished loading.
AdManager.getInstance().isVideoReady();
Check the video ad is loaded complete. If call showVideo directly when an ad has not finished loading unpredictable events will occur, some advertising platform could lead to crash.<br/> So make sure the video is ready before every show.Below is the overall look.
if(AdManager.getInstance().isVideoReady()){
AdManager.getInstance().showVideo(this);
}
h. Application load and display more app advertising
AdManager.getInstance().loadAppWall(this);
Load more app ads, does not automatically show after load successfully, this can better control video ad at the right time to show to the user,<br/> If you want to show immediate after load,just handler onLoadedSuccess in eventListener and call showAppWall.<br/>
AdManager.getInstance().showAppWall(this);
Display more app ads, ads will appear immediately after the call showAppWall. However, please ensure that advertising has finished loading.
AdManager.getInstance().isAppWallReady();
Check the More App ad is loaded complete. If call showAppWall directly when an ad has not finished loading unpredictable events will occur, some advertising platform could lead to crash.<br/> So make sure the More App is ready before every show.Below is the overall look.<br/>
if(AdManager.getInstance().isAppWallReady()){
AdManager.getInstance().showAppWall(this);
}
3.Setting Profiles
a.Configuring Permissions
<!-- base permission -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- base permission for location-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- base permission required by chartboost and baidu-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- permission required by mmedia -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
The above are permissions advertising platform needs, basic permissions are required by all advertising platform, location is required by some platforms, in order to save the sake , both blocks can be added to this configuration.<br/> WRITE_EXTERNAL_STORAGE permission is required by chartboost, if added chartboost, you need to add this permission.<br/> The audio and microphone permissions are required by mmedia, if used mmedia platform, add it to configuration<br/>
b.Config platform services and activity
<!-- Admob -->
<meta-data
android:name="com.google.android.gms.version"
android:value="10084000" />
<activity
android:name="com.gg.e.abs.AaActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSiz
Related Skills
openhue
353.3kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
353.3kElevenLabs text-to-speech with mac-style say UX.
weather
353.3kGet current weather and forecasts via wttr.in or Open-Meteo
casdoor
13.3kAn open-source AI-first Identity and Access Management (IAM) /AI MCP & agent gateway and auth server with web UI supporting OpenClaw, MCP, OAuth, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, Google Workspace, Azure AD
