Android Question Any news about Native Ads Advanced?

Discussion in 'Android Questions' started by asales, Jan 9, 2018.

  1. asales

    asales Well-Known Member Licensed User

    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 currently in a closed beta with a limited group of publishers" is out of date), but I don't have a option in FirebaseAdmob library to use it, only NativeExpressAd.

    native2.jpg

    Any news about when we can get the updated FirebaseAdmob library?

    Thanks in advance for your attention about this issue.
     
    Multiverse app and analizer3816 like this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    It looks like it is still not publicly available:

    1: [​IMG]

    2: [​IMG]
     
    Multiverse app likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. asales

    asales Well-Known Member Licensed User

    Weird, because to me they it appears (see image below).

    I can create the native ads but I can use they in B4A.

    But I saw the answer of the SDK team: the native express is discontinued but they don't have a timeline to release the native advanced. Bad news, but thanks for your effort!
    native3.jpg
     
  5. analizer3816

    analizer3816 Member Licensed User

  6. Erel

    Erel Administrator Staff Member Licensed User

    I will add it to FirebaseAdMob once it is publicly available.
     
  7. Multiverse app

    Multiverse app Active Member Licensed User

    I have been waiting to get native advanced ads for months now. Banner ads look ugly and have very less RPM. let's hope Google makes it available fast.
     
    asales likes this.
  8. asales

    asales Well-Known Member Licensed User

    +1
     
  9. Douglas Farias

    Douglas Farias Expert Licensed User

    Hi @Erel .
    Sorry to reopen a old thread.

    but you have a plan to add advanced native ads to firebase admob lib?
    if yes can you talk when?(day)?

    we have some apps with normal native ads and on day 01 of month 02 (01/02) it will no more works.
    google contacted me and talked about, change with urgency native ads to advanced native ads (the normal native ads will show only a blank page).

    thx
     
    Last edited: Jan 29, 2018
    asales likes this.
  10. DonManfred

    DonManfred Expert Licensed User

    He already answered this. He´ll add them if the are publicity available.

    They are still in Beta! So i guess nothing will happen and he can´t answer when as it is not known when they are public available.
     
    Peter Simpson likes this.
  11. asales

    asales Well-Known Member Licensed User

    I'm in same boat of @Douglas Farias.
    For me too the native ads is not in beta stage anymore.
    There is a deadline from the Google and the will stop show ads.
     
  12. DonManfred

    DonManfred Expert Licensed User

    Based on the Docu it is still in beta.

    https://developers.google.com/admob/android/native-advanced
     
  13. asales

    asales Well-Known Member Licensed User

    This is a deadline letter that Google sent to me.

    The problem is that I use the native express ads in several places that not is recomended to use a banner.

    admob010318.jpg
     
  14. Multiverse app

    Multiverse app Active Member Licensed User

    upload_2018-1-30_17-50-8.png
    Native ads are not public yet. Hope they come out soon.
     
    DonManfred likes this.
  15. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]
    This code will help you get started:
    Code:
    Sub LoadNativeAd
       
    Dim AdUnitId As String = "ca-app-pub-3940256099942544/2247696110"
       
    Dim ctxt As JavaObject
       ctxt.InitializeContext
       
    Dim builder As JavaObject
       builder.InitializeNewInstance(
    "com.google.android.gms.ads.AdLoader.Builder"Array(ctxt, AdUnitId))
       
    Dim OnContentAdLoadedListener As Object = builder.CreateEventFromUI("com/google/android/gms/ads/formats/NativeContentAd.OnContentAdLoadedListener".Replace("/""."), _
           
    "ContentAdLoaded"Null)
       builder.RunMethod(
    "forContentAd"Array(OnContentAdLoadedListener))
       
       
    Dim Listener As JavaObject
       Listener.InitializeNewInstance(
    Application.PackageName & ".main$MyAdListener"Array("NativeAd"))  'change 'main' with the current activity module name
       builder.RunMethod("withAdListener"Array(Listener))
       
    Dim AdLoader As JavaObject = builder.RunMethod("build"Null)
       
    Dim AdRequestBuilder As JavaObject
       AdRequestBuilder.InitializeNewInstance(
    "com/google/android/gms/ads/AdRequest.Builder".Replace("/""."), Null)
       AdLoader.RunMethod(
    "loadAd"Array(AdRequestBuilder.RunMethod("build"Null)))
       
    Wait For ContentAdLoaded_Event (MethodName As String, Args() As Object)
       
       
    Log("ContentAdLoaded_Event")
       
    Dim NativeContentAd As JavaObject = Args(0)
       
    Log(NativeContentAd.RunMethod("getHeadline"Null))
       
    Dim NativeContentAdView As JavaObject
       NativeContentAdView.InitializeNewInstance(
    "com/google/android/gms/ads/formats/NativeContentAdView".Replace("/""."), _
           
    Array(ctxt))
       
    Dim pNativeAdView As Panel = NativeContentAdView
       
    Dim content As Panel
       content.Initialize(
    "")
       pNativeAdView.AddView(content, 
    00300dip300dip)
       
    Dim lbl As Label
       lbl.Initialize(
    "")
       lbl.Text = NativeContentAd.RunMethod(
    "getHeadline"Null)
       content.AddView(lbl, 
    10dip10dip300dip50dip)
       NativeContentAdView.RunMethod(
    "setHeadlineView"Array(lbl))
       
    Dim lbl2 As Label
       lbl2.Initialize(
    "")
       lbl2.Text = NativeContentAd.RunMethod(
    "getBody"Null)
       content.AddView(lbl2, 
    10dip60dip300dip50dip)
       NativeContentAdView.RunMethod(
    "setBodyView"Array(lbl2))
       
    Dim logo As JavaObject = NativeContentAd.RunMethod("getLogo"Null)
       
    If logo.IsInitialized Then
           
    Log("adding logo")
           
    Dim logoView As Panel
           logoView.Initialize(
    "")
           logoView.Background = logo.RunMethod(
    "getDrawable"Null)
           content.AddView(logoView, 
    200dip0100dip100dip)
           NativeContentAdView.RunMethod(
    "setLogoView"Array(logoView))
       
    End If
       
    Dim images As List = NativeContentAd.RunMethod("getImages"Null)
       
    If images.IsInitialized And images.Size > 0 Then
           
    Log("adding image")
           
    Dim imgView As Panel
           imgView.Initialize(
    "")
           
    Dim image As JavaObject = images.Get(0)
           imgView.Background = 
    image.RunMethod("getDrawable"Null)
           content.AddView(imgView, 
    200dip100dip100dip100dip)
           NativeContentAdView.RunMethod(
    "setImageView"Array(imgView))
       
    End If
       NativeContentAdView.RunMethod(
    "setNativeAd"Array(NativeContentAd))
       
    Activity.AddView(pNativeAdView, 00100%x200dip)
    End Sub

    Sub NativeAd_FailedToReceiveAd (ErrorCode As String)
       
    Log("NativeAd_FailedToReceiveAd: " & ErrorCode)
    End Sub

    Sub NativeAd_AdOpened
       
    Log("NativeAd_AdOpened")
    End Sub

    #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);
       }
    }
    #End If
    This is not complete. You can see all the available resources here: https://developers.google.com/android/reference/com/google/android/gms/ads/formats/NativeContentAd
    Each resource should be set to a view and you should then call NativeContentAdView setXXXView.
    NativeContentAdView: https://developers.google.com/andro...e/android/gms/ads/formats/NativeContentAdView

    Note that it will be easier to create the layout with the designer and load it with content.LoadLayout.
     
    Last edited: Feb 15, 2018
  16. asales

    asales Well-Known Member Licensed User

    Thank you very much, @Erel.

    I'm try several modifications in this code.
    One thing that I want to do is to show 2 native ads in same activity.
    So I created a sub "LoadNativeAd2" and I call LoadNativeAd (top = 0) and LoadNativeAd2 (top = 50%y), but only last sub that I call is showing.
    LoadNativeAd (first)
    LoadNativeAd2 (last)
    or
    LoadNativeAd2 (first)
    LoadNativeAd (last)

    don't matter

    What could be happening?
    How I can show 2 ads in same activity?

    Thanks in advance for any tip.
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    Change the wait for line to:
    Code:
    Wait For (builder) ContentAdLoaded_Event (MethodName As String, Args() As Object)
     
    asales and Peter Simpson like this.
  18. Douglas Farias

    Douglas Farias Expert Licensed User

    Hi erel.

    i m tested your code today, and this give some crash

    how can i fix this pls?
    i see u made a if to check if contains image, the code enter on this if but i dont know give crash when will get the image
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    Run it in debug mode. Which line raises the error (post the code itself)?
     
  20. Douglas Farias

    Douglas Farias Expert Licensed User

    sorry to dont post the line.
    the error on debug mode is on this line

    Code:
    imgView.Background = logo.RunMethod("getDrawable"Null)

    here is the log
    Note: Duploxxis Delivery on log its a ad name. (it is working getting ads title)
    the problem is the image only
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice