Search code examples
androidadmobonbackpressed

How to continue app after back is pressed on clicking admob ad?


I am making a fitness app. During the rest period of fixed time I am showing ads using AdMob. If a user clicks on the ad then the app opens up browser/playstore. When the user clicks on back the browser/playstore closes and the user comes back to my app. But my app doesn't realize this and remains frozen. The rest period does not reduce. Only on clicking the app, does the app know that it is active. Is there a way to tell the app to continue once back is pressed after an admob ad is clicked?


Solution

  • When your app loses focus everything is paused. Override onResume method in your activity to restart what ever appears to be paused as per their normal behavior or you have explicitly pauses in onPaused method.