0

I'm trying to use Vserv ad network in my J2ME application(The Banner Ad one) but until now i can't receive any ads,i don't get any exception, i just notice that the vservAdFailed() method is always executed first, and the debug result is :

Ad Failed o=vInAppAdEngine.VservAd@e5125d64

This is the screen which must have the ad, i put all the code in it. What is missing?!

 public class Vserv extends Screen implements  VservAdListener{


private VservManager vservManager;
private VservAd vservAd;
public Vserv(byte screenName,AppMidletBuilder app,AppData appData,Operation operation  ){
    super(screenName,app,appData.getLocalizationUtil(),appData.getImageUtil(),appData,operation);
    //This is required only once in your application life cycle
    Hashtable vservConfigTable=new Hashtable();
    vservConfigTable.put("appId","My app Id");
    vservManager=new VservManager(app,vservConfigTable);

} 


protected void initScreen() {

   //This is required for requesting new ad
    vservAd=new VservAd(Vserv.this);
    vservAd.requestAd();
}

protected void screenDefinition() {

}

public void vservAdReceived(Object obj) {

     System.out.println("Ad Recieved");
         if(((VservAd)obj).getAdType().equals(VservAd.AD_TYPE_IMAGE))
    {
    //Use retrived image ad for rendering
    Image imageAd=(Image)((VservAd)obj).getAd();
    } else if(((VservAd)obj).getAdType().equals(VservAd.AD_TYPE_TEXT))
    {
    //Use retrieved text ad for rendering
    String textAd=(String)((VservAd)obj).getAd();
}
}

public void vservAdFailed(Object o) {

     System.out.println("Ad Failed o="+o);
}

 }
Reham
  • 1,916
  • 6
  • 21
  • 45

2 Answers2

0

Have you replaced My app Id here

vservConfigTable.put("appId","My app Id");

Also the vservAdFailed() method is executed when no ads are available for your request.

Ravi Vyas
  • 12,212
  • 6
  • 31
  • 47
  • Yes sure i replaced it, So the problem is with the request itself? or there is no ads to be displayed? until now i did not see any ads since 2 weeks.. – Reham Aug 21 '12 at 14:40
0

You should have a button to handle the image rendered(Image Ad). Something like

imageItem = new ImageItem("", imageAd, ImageItem.LAYOUT_DEFAULT, "", Item.BUTTON);
Luís Cruz
  • 14,780
  • 16
  • 68
  • 100
Scoob
  • 1