Hi everyone
My application is getting more memory consumption when I use Admob banners.
I found similar issues reporting memory leak:
https://stackoverflow.com/questions...-destroy-method-inside-a-recyclerview-adapter
https://stackoverflow.com/questions/9558708/admob-memory-leak-avoiding-by-using-empty-activity
A solution presented was to destroy the View Admob with destroy().
Does anyone know how to implement this method for this Admob case?
I'm trying to use jo.RunMethod("destroy", Null) but it's not working. I don't know how to use it.
I tried using BannerAd.RemoveView, panel1.RemoveAllViews but it didn't work.
.
My application is getting more memory consumption when I use Admob banners.
I found similar issues reporting memory leak:
https://stackoverflow.com/questions...-destroy-method-inside-a-recyclerview-adapter
https://stackoverflow.com/questions/9558708/admob-memory-leak-avoiding-by-using-empty-activity
A solution presented was to destroy the View Admob with destroy().
Does anyone know how to implement this method for this Admob case?
I'm trying to use jo.RunMethod("destroy", Null) but it's not working. I don't know how to use it.
B4X:
Sub Globals
Private BannerAd As AdView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim adSize As JavaObject
adSize.InitializeNewInstance("com.google.android.gms.ads.AdSize", Array(320, 50))
BannerAd.Initialize2("BannerAd", "ca-app-pub-xxxxxxxxxxxx/xxxxxxxxx", adSize)
panel1.AddView(BannerAd,(panel1.Width/2) -160dip,0dip,320dip,50dip)
BannerAd.LoadAd
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Dim jo As JavaObject = BannerAd
jo.RunMethod("destroy", Null)
End Sub
I tried using BannerAd.RemoveView, panel1.RemoveAllViews but it didn't work.
.