Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Implement ad providers in android apps  (Read 1577 times)

0 Members and 1 Guest are viewing this topic.

mihaipuiucernea

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Currently working on Colors on Canvas
    • View Profile
    • Dev Blog
Implement ad providers in android apps
« on: February 12, 2015, 12:11:11 PM »

Hi guys,

Suppose I make a free Android game, but I want to monetize via ads. Can it be done? Can I implement admob, leadbolt, airpush and similar ad providers in WME Lite? And if the answer is yes, how hard is it?

Thanks!

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 157
    • View Profile
Re: Implement ad providers in android apps
« Reply #1 on: February 12, 2015, 09:48:14 PM »

Hi guys,

Suppose I make a free Android game, but I want to monetize via ads. Can it be done? Can I implement admob, leadbolt, airpush and similar ad providers in WME Lite? And if the answer is yes, how hard is it?

Thanks!

I guess so. I'm thinking about a "sort-of" generic scripting interface for controlling ads from wmelite. These would interact with the Java part of the engine (actually the Java part of SDL, which wmelite uses). In the Java world, the connection to the ad provider(s) can be done easily by yourself - which one you use, that would then be up to you.

It is not too difficult, but I haven't found any time yet to start working on this. The most difficult task is, from my point of view, to implement the JNI (Java Native Interface) part of the "wmelite scripting" <--> "ad provider" interface. You might use the existing callback implementations (for charset and other stuff) as reference.
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 157
    • View Profile
Re: Implement ad providers in android apps
« Reply #2 on: February 22, 2015, 11:12:08 AM »

Hi guys,

Suppose I make a free Android game, but I want to monetize via ads. Can it be done? Can I implement admob, leadbolt, airpush and similar ad providers in WME Lite? And if the answer is yes, how hard is it?

Thanks!

I guess so. I'm thinking about a "sort-of" generic scripting interface for controlling ads from wmelite. These would interact with the Java part of the engine (actually the Java part of SDL, which wmelite uses). In the Java world, the connection to the ad provider(s) can be done easily by yourself - which one you use, that would then be up to you.

It is not too difficult, but I haven't found any time yet to start working on this. The most difficult task is, from my point of view, to implement the JNI (Java Native Interface) part of the "wmelite scripting" <--> "ad provider" interface. You might use the existing callback implementations (for charset and other stuff) as reference.

I have implemented a first idea of said interface. It is currently tested with "AdBuddiz" only.

There are now 2 new scripting functions:

Code: [Select]
int Game.advertisementPrepare(String key, int number)
int Game.advertisementShow(String key, int number)

These are transparently passed from wmelite to the Java part of the app:

Code: [Select]

public int advertisementPrepare(String key, int number)
{
return 0;
}

public int advertisementShow(String key, int number)
{
return 0;
}


With these placeholders, you can (hopefully) add any advertisement provider to your game and control the displaying of ads via scripts.

In case of AdBuddiz, you can follow the instructions on their website, and then fill in the placeholders like this:

Code: [Select]

public int advertisementPrepare(String key, int number)
{
System.out.println("Query Advertisement SDK to prepare ads/check if ads prepared. Key=" + key + ",number=" + number + ".");

// place appropriate code here
if (AdBuddiz.isReadyToShowAd(act)) { // this = current Activity
                         return 1;
                }

return 0;
}

public int advertisementShow(String key, int number)
{
System.out.println("Instruct Advertisement SDK to show an ad. Key=" + key + ",number=" + number + ".");

// place appropriate code here
AdBuddiz.showAd(act);

return 0;
}


to have the 2 functions "isReadyToShowAd" and "showAd" controllable via scripts. (The example is not complete, I have omitted some other code changes, just to illustrate the part about controlling the advertisement by scripts.)

By making use of the additional parameters (which are unused in my example), you can do more complex operations (and hopefully use other ad providers as well).
Logged

mihaipuiucernea

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Currently working on Colors on Canvas
    • View Profile
    • Dev Blog
Re: Implement ad providers in android apps
« Reply #3 on: February 23, 2015, 09:52:03 PM »

Thank you very much!  ::rock I hope this will also be of help to others!
 

Page created in 0.148 seconds with 17 queries.