Android Question [SOLVED][B4XPages] Error in Native Ad java code

asales

Expert
Licensed User
Longtime User
I tried to use the original code of Native Ads Advanced in a B4XPages project:

There is a java code to check options like AdLoaded, AdFailedToLoad, etc.
I use the AdFailedToLoad to check what is the problem occours when I tried to load the native ad.
B4X:
#if Java
public static class MyAdListener extends com.google.android.gms.ads.AdListener {
   String eventName;
   public MyAdListener(String s) {
       eventName = s.toLowerCase(BA.cul);
   }  
   @Override
   public void onAdClosed() {
       processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_adclosed", false, null);
   }
   @Override
   public void onAdFailedToLoad(int arg0) {
       processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_failedtoreceivead", false, new Object[] {String.valueOf(arg0)});
   }
   @Override
   public void onAdLeftApplication() {
       processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_adleftapplication", false, null);
   }
   //@Override
   //public void onAdOpened() {
   //    processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_adopened", false, null);
   //}
   @Override
   public void onAdLoaded() {
       processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_receivead", false, null);
   }   
   @Override
   public void onAdClicked() {
       processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_clicked", false, null);
   }
   /**
    *Should be called from Activity_Pause.
    */
   //public void Pause() {
    // getObject().pause();
   //}
   /**
    *Should be called from Activity_Resume.
    */
   //public void Resume() {
    //getObject().resume();
   //}   
}
#End If
In an Activity project works fine, but if I use this in a B4xPages project, I get this error when I tried to compile:
B4X:
Compilando o código Java.    Error
src\br\com\testes\b4xmainpage.java:1452: error: cannot find symbol
       processBA.raiseEventFromDifferentThread(null, null, 0, eventName + "_adclosed", false, null);
       ^
  symbol:   variable processBA
  location: class MyAdListener
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

What could be the problem and how I can fix it?

Thanks in advance for any tip.
 
Top