I'm trying to integrate Admob interstitial ads to my android app and for some reason. Every time I open an ad it calls my activity onDestroy method witch results on my app being closed without any log-cat errors or messages.
Does anyone knows what may be causing my app to close once Admob interstitial is opened ?
Thanks in advance.
Android closes processes if needed when an application enters the background. You need to be able to handle the destruction of the activity. Look into saving instance states HERE
Related
I'm implementing rewarded video on an application in c++ on ios and android, but the crash happened only on android. It happens only sometimes, when it comes from background to foreground.
I got the message Abort message: 'rewarded_video::Initialize() must be called before this method.' on crash report, and I think it`s when the resume method from the rewarded video is called.
Does anybody knows if I have someway of knowing if resume is supposed to be called? Or should it be called whenever the app enters foreground?
Thanks in advance,
Felipe.
I found out what the problem was. My app on android was creating another instance when opened from another source, and that was causing the error message on the rewarded video.
I added android:launchMode="singleTask" on the manifest and it worked.
I'm using the GoogleMobileAdsSdkAndroid.zip (Version 6.4.1), with android-13 specified as the target in project.properties in Eclipse.
When I was developing and testing the app, I was using adMob in test mode. The ads loaded, displayed and refreshed ok. However, when I clicked on an ad, it didn't click through. A window opens very very briefly but immediately closes and my app resumes again (it looks like the onResume method is called from a brief inspection).
I thought that this was just due to it being in test mode, so I pushed my app out to Google Play anyway with testing turned off.
However, testing it on a friend's phone, it does exactly the same thing.
Any ideas gratefully received?
Thanks.
Cracked it! The AdMob Activity and the main activity for my app have to run in the same process. I had specified a particular process in the main activity for my app in the AndroidManifest.xml, but hadn't specified the same process in the AdMob activity. As soon as I did that, all is working.
.
I deleted the following code from onUnifiedNativeAdLoaded method and problem solved!
if (unifiedNativeAd!= null) {
unifiedNativeAd.destroy();
}
I've integrated AdMob with my app. I can't seem to find this in any AdMob references.
Are AdMobs still running and bringing you revenue even if the app is in background or the ad is not visible? (for example
the user pressed the "Home" button
the user turned off the screen
the ad is positioned outside screen bounds
In my opinon this is clearly a wrong behavior if AdMob is still requesting ads and paying money per impressions in any of the above cases.
How does this actually work? Can anyone point me to a link/reference that exaplains this behavior?
Thanks
Clicking back, home, or closing your phone will pause your application but not terminate it. It is possible to run your application as a Service\WakeLock and it will continue to run in the background. Admob requests should not be running in the background if your application is paused. You should not be receiving impressions or revenue while your application is in the background.
Quote from AdMob: background requests?
You can see in LogCat when AdMob is requesting ad. Are you seeing any
requests when your app is in the foreground (you should), and when
your app pauses (you should not see any requests)?
By: Android Dev Guy
I've created a simply web radio streaming app, and on of my app user told me that sometimes when he open another app (for example, Facebook app) my app gets close without error.
How can I trace this event?
Thank you!
It sounds like your app is simply experiencing the standard Activity lifecycle.
When the user leaves your app (eg opens the Facebook app), onStop() is called. From there, the app can either be restarted, it can just sit there, or it can be destroyed.
Since the Facebook app is fairly resource-intensive, I am guessing that the system is destroying your app to free up resources for the Facebook app, or whatever other app is being launched.
If you tell us more about what you are trying to accomplish, we can provide more suggestions on how to do that.
i am working on an application.The first screen having login.After launching the application in device and playing with it is all ok and not any issue at all.
but if at the same time user opens any other application,uses it for a while and closes this second application and then again navigate to previously open application(on which i am working),and tries to tap or manipulate or login on the application ,application gets crashed. why so behaviour?
i am facing this issue very first time and no any idea of this.
any suggestion?
Thanks.
Check out the Android app lifecycle: http://developer.android.com/reference/android/app/Activity.html.
My guess is the Activity that your user is coming back in to is overriding the onResume() method and the method is throwing an exception or you're not calling super.onResume(). That's my best guess without any more details on what your code is doing or information from your logCat.