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.
In an Activity project works fine, but if I use this in a B4xPages project, I get this error when I tried to compile:
What could be the problem and how I can fix it?
Thanks in advance for any tip.
Any news about Native Ads Advanced?
Hi @Erel I have several Native Ads Express in my apps and the existing units will stop serving ads on March 1, 2018 (https://developers.google.com/admob/android/native-express). The new Native Ads Advanced is available now and I can create this Ads (I think the information in page "Native is...
www.b4x.com
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
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.