How to Monetize Your Android App with MobFox Network

1:09 PM 0 Comments


     Making money from your app is not a nightmare if your app has enough users. Generally, many developers give up after seeing a dramatic variation of eCPM and RPM. There are many ways to boost your ad revenue from low rpm. If you search in Google "App Monetization", a huge list of ad networks will show within a few seconds. You might have noticed that many app monetization networks offering maximized eCPM and high revenue but it is a bit difficult to choose from hundreds ofapp monetization networks. In this app monetization tutorial we will discuss about MobFox network, and How to implement ads to your app.
How to Monetize Your Android App with MobFox Network
About MobFox
MobFox offers banner ads, interstitial ads, and fully customizable native ads. One of the great things about this platform is it comes with open source SDK. You can work seamlessly with Android and iOS SDKs. Over 30+ ad networks are integrated by default besides you can easily add support for new networks. You have full control over your ads, unwanted ads can be blocked by efficient filters.
Prerequisites for MobFox implementation

1. You must have a MobFox account.
2. MobFox SDK for Android.

Integrate Google play services using Android Studio
Open the build.gradle from your application module directory
Add a new build rule like below
apply plugin: 'com.android.application'
    ...

    dependencies {
        compile 'com.google.android.gms:play-services:7.x.x'
    }
Note : Version number may change each time when Google Play services is updated.
Save your project and Click Sync Project with Gradle Files
Done.

Getting started with MobFox

Login to your account https://account.mobfox.com
Create a new app from Publisher section (Make sure that you have selected Android as platform)
Copy your Inventory Hash (a unique publisher id)

Integrate into your Android Project

Download MobFox SDK for Android
http://sdk.starbolt.io/MobFox-Android-SDK.zip
Unzip SDK and copy AdSdk_7.0.1.jar and simple-xml-2.7.1.jar to libs folder of your project.
Update manifest file as below

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
Add Google Play services Meta tag under Application tag
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

Add the following activities

<!-- mobfox ads -->
        <activity android:name="com.adsdk.sdk.banner.InAppWebView" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <activity android:name="com.adsdk.sdk.video.RichMediaActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:hardwareAccelerated="false" />
        <activity android:name="com.adsdk.sdk.mraid.MraidBrowser" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <!-- ends -->
Save the file.
Show banner Ad using XML (Direct Ad)

Create an activity called TestAdMobFox open the corresponding xml file, add the Banner AdView.
XML layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativePackage}.${activityClass}" >

     <com.adsdk.sdk.banner.AdView android:id="@+id/mobFoxView" android:layout_width="300dp" android:layout_height="50dp" android:layout_alignParentRight="true" adspaceHeight="50" adspaceStrict="true" adspaceWidth="320" animation="true" location="true" publisherId="ENTER_YOUR_HASH" request_url="http://my.mobfox.com/request.php" android:background="#000000" />

     <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/mobFoxView" android:layout_centerHorizontal="true" android:layout_marginTop="71dp" android:text="ShowAdMe" />

</RelativeLayout>
You need to assign an Inventory Hash to publisherId. Run your project, you could see the test banner, live ad will show only if your app is approved.
MobFox Interstitial Ad
You can initialize interstitial ad,
mManager = new AdManager(this, "http://my.mobfox.com/request.php","ENTER_HASH", true);
            mManager.setInterstitialAdsEnabled(true);
            mManager.setListener(this);
mManager.requestAd();

To show the Ad, call showAd() method.
Full Code TestAdMobFox.java

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import com.adsdk.sdk.Ad;
import com.adsdk.sdk.AdListener;
import com.adsdk.sdk.AdManager;
public class TestAdMobFox extends Activity implements AdListener {
 private AdManager mManager;
 private Button s;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_test_ad_mob_fox);
  s=(Button)findViewById(R.id.button1);
  mManager = new AdManager(this, "http://my.mobfox.com/request.php","ENTER_HASH", true);
  mManager.setInterstitialAdsEnabled(true); 
  mManager.setListener(this);
  mManager.requestAd();
    
  s.setOnClickListener(new OnClickListener() {
   
   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
    if (mManager != null && mManager.isAdLoaded())
    {
     mManager.showAd();
    }
    else
    {
     Toast.makeText(getApplicationContext(), "Failed to load Ad", Toast.LENGTH_SHORT).show();
    }
   }
  });
  
 }
 @Override
 public void adClicked() {
  // TODO Auto-generated method stub
  
 }
 @Override
 public void adClosed(Ad arg0, boolean arg1) {
  // TODO Auto-generated method stub
  
 }
 @Override
 public void adLoadSucceeded(Ad arg0) {
  // TODO Auto-generated method stub
  
 }
 @Override
 public void adShown(Ad arg0, boolean arg1) {
  // TODO Auto-generated method stub
  
 }
 @Override
 public void noAdFound() {
  // TODO Auto-generated method stub
  
 }
}

MobFox Android Test Ad

Hi Nikinmon SK i like to share my knowledge !

0 comments: