On rotation app size increases due to banner ad

75 views
Skip to first unread message

Abhishek

unread,
Dec 15, 2017, 5:17:36 AM12/15/17
to Google Mobile Ads SDK Developers
Hi,

I am developing an application which will allow user to read articles. I have to display a banner ad at bottom. In landscape mode banner ad size will be 970x90, while in portrait mode banner ad size will be 728x90.
I have to load ad whenever device will rotate as per client instruction. But, when i update the ad display view frame and send the request to fetch updated ad, running memory get increased by 2 - 3MB.
I have created a demo app using same approach, please go through it and tell me what am i doing wrong? or is there  any other issue?
Please find demo application on given link and help me to resolve this abnormal behaviour.


Thanks in advance.

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 15, 2017, 2:25:28 PM12/15/17
to Google Mobile Ads SDK Developers
Hi Abhishek, 

Firstly, it looks like you're implementing Mobile Ads SDK Banner ads, you could call GADBannerView and use the Ad Unit ID specified in the code sample. For this specific use case, you could consider using the smart banner ads with AdSize constants, kGADAdSizeSmartBannerPortrait and kGADAdSizeSmartBannerLandscape. This will render the screen-width banner ads on any screen size across different devices in either orientation. You may refer to this guide for more information. You could also refer to this blog post for more implementation guidance.

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

Abhishek

unread,
Dec 18, 2017, 12:30:32 AM12/18/17
to Google Mobile Ads SDK Developers
Hi Bharani, 

Now, as you suggested, i am using GADBannerView with the smart banner ads, kGADAdSizeSmartBannerPortrait and kGADAdSizeSmartBannerLandscape, but it seems like it doesn't make any difference. Size is getting increased on every rotation by 2-3 MB. Again, i am attaching my updated code, please go through it and suggest me what can i do to reduce app running memory? 

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 18, 2017, 12:57:37 PM12/18/17
to Google Mobile Ads SDK Developers
Hello Abhishek, 

Thank you for providing the details. This looks like an implementation issue. I see that you're requesting an ad on every rotation. It is possible that it might be causing the memory increase. Also, could you try replacing your logic with this:

override func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) {
if (UIInterfaceOrientationIsLandscape(UIInterfaceOrientation.landscapeRight)) { 
self.bannerView.adSize = kGADAdSizeSmartBannerLandscape
} else { 
self.bannerView.adSize = kGADAdSizeSmartBannerPortrait; 

}

I was able to test this logic with our sample app and did not see any memory issue. Additionally, make sure that you specify adSize constraints to fit both landscape and portrait modes. 
Message has been deleted
Message has been deleted
Message has been deleted

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 19, 2017, 2:13:48 PM12/19/17
to Google Mobile Ads SDK Developers

Hello Bharani, 

I have downloaded the sample app and tested it, I found that it is working perfect with 320x50 ad size and your implemented ad unit id.

But when I changed banner view size constraints in storyboard and used my ad unit id, sample app size started to increase on app rotation with out reloading the ad.

Now, I don’t think that it is an issue of implementation because I have changed only constraints and ad unit id in your sample app. Please correct me if am I wrong?

Following changes I have made in sample app:

Modified banner view constraints :

Leading: superview

Trailing: superview

Bottom: superview

Height: 90

My ad unit id: ca-app-pub-xxxxxxxxxx/xxxxxxxxxxx

Now, please please go through the modified sample app and suggest me the solution, so that I can control the increasing memory of attached sample app. Is there any problem with the ad unit id?

Modified sample app link: https://drive.google.com/open?id=1tmf8OkKAwF7qkMeTod39r0U_BpK2P_0b


Regards,
Abhishek Kumar Verma

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 19, 2017, 2:16:01 PM12/19/17
to Google Mobile Ads SDK Developers
Hi Abhishek, 

Thank you for providing the sample app. I deleted your previous post which contained sensitive information. As for your concern, could you please elaborate on how you're calculating the memory increase and provide us details for this, so I can take a look? Additionally, could you please confirm if you're experiencing the issue on any specific device? If you could provide these details, it will really help us debug the issue further. Please use Reply privately to author option to share the details.

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 20, 2017, 3:22:06 PM12/20/17
to Google Mobile Ads SDK Developers
Hello Abhishek, 

Thank you for providing the details. I have shared this information with the team and they are investigating the issue. I will update this thread if I have any new information. 

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

On Friday, December 15, 2017 at 5:17:36 AM UTC-5, Abhishek wrote:

Abhishek

unread,
Dec 26, 2017, 1:38:55 AM12/26/17
to Google Mobile Ads SDK Developers
Hello Bharani,

Any update on this issue? my app is on hold due to this. If there is any alternate option, please suggest.


Regards,
Abhishek Kumar Verma

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 27, 2017, 9:19:30 AM12/27/17
to Google Mobile Ads SDK Developers
Hi Abhishek, 

Our team is currently investigating the issue. I will update this thread if I have any new information. 

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

On Friday, December 15, 2017 at 5:17:36 AM UTC-5, Abhishek wrote:

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Jan 3, 2018, 5:31:41 PM1/3/18
to Google Mobile Ads SDK Developers
Hi Abhishek, 

Thank you for your patience. Our team was able to confirm that this is working as intended. Loading multiple ads means multiple webviews (we start the second webview and load the second ad before swapping the first one out), and so it's expected that memory starts to increase after a few rotations. However, the memory usage plateaus after several rotations, indicating no memory leaks. Let me know if you have any other questions.

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

On Friday, December 15, 2017 at 5:17:36 AM UTC-5, Abhishek wrote:
Reply all
Reply to author
Forward
0 new messages