Do you want to see more tutorials? Please buy me some beer! :)
2) LET'S MAKE SOME MONEY - ADDING LEADBOLT ADS
Welcome to my second tutorial in which I show you how to add
leadbolt ads to your app - ads called NOTIFICATIONS. Please note that these ads are not shown in the game, but preinstalled on the users phone. These ads are extremely profitable - the average eCPM is $7.00-$20.00! More info about NOTIFICATIONS ads
here
You will need:
-
register to leadbolt
-
project files from the
previous tutorial
If you have these 2 things ready, lets start! ;-)
1) When you login to leadbolt click the tab
APPS and there click
CREATE NEW APP / MOBILE WEB button. You should see the popup below. Fill in all the fields (mainly choose
NOTIFICATION in placement type) and click
CREATE NOW! Note down the
number that will appear in the next popup!
2) Now we need to download the SDK! You can get it from here
DOWNLOAD SDK. Unzip the file
LeadboltController.jar and put it to folder of you choice or on desktop.
3) Now we must import the SDK to our project. Open
ECLIPSE, right-click on the project name and choose
NEW ->
FOLDER as shown below. In the next window enter to folder name
libs and click
finish. Now you should see the new folder called LIBS created in your project
4) Now find and select the
LeadboltController.jar file we downloaded earlier (step 2) and drag it to the folder
libs we just created!
5) You should see a popup below. Click
OK. You should see the file inside the
libs folder now!
6) Now we must link the SDK to our project. Right-click on the project name and choose
Properties. New popup will appear (shown below). Click on
Java Build Path on the left and then click
Add JARs... on the right as shown below.
7) New popup will appear. Find the
libs folder as show below. Select the file inside the
libs folder and click
OK. Click
OK again.
8) Now the SDK is imported and linked to our project! Lets update the code! Select MyGameActivity.java in
src->com->somedomain->MyGame folder that we created in the last tutorial.
9) Add these 2 lines in the onCreate function..
AdController myController = new AdController(getApplicationContext(), "YOUR_ADS_ID");
myController.loadNotification();
...so it looks like on the screen below...
10) Replace
YOUR_ADS_ID in the code in step 9 by the number you got in step 1!
11) And the last step! We must add some permissions to the Android manifest to be able to load the advertisement! Open
AndroidManifest.xml
and paste these lines of code just after closing
</application> tag
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
..your manifest file should look like this..
And to enable the leadbolt ads we need to add one more line of code just above the closing
</application> tag:
<receiver android:name="com.Leadbolt.AdNotification" />
Thats all! :-) You just inserted a paid advertisement to your application! You can export an APK file as shown in tutorial nr.1 and start earning some money!
- Download one of my final game project files here. It includes also APK of the project in BIN folder, if you install it on your phone and run it you should see a game Madpet Skateboarder with a leadbolt ads implemented!
- Check out the games I created and published with leadbolt on the Android market or visit my game portal littlebigplay.com
- register to leadbolt
Do you want to see more tutorials? Please buy me some beer! :)