I am working with Facebook's Audience Network in my android app that I am building. My onCreate method codes are,
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
this.facebookAdOneLayout = (RelativeLayout) findViewById(R.id.facebook_ads_one);
loadFacebookBannerAds();
}
And my codes that are loading Facebook ads,
private void loadFacebookBannerAds() {
this.facebookAdOne = new com.facebook.ads.AdView(this, getString(R.string.fb_ad_id_one),
AdSize.BANNER_320_50);
//This setting is to load test ads served by Facebook. Just delete whole line in live app
AdSettings.addTestDevice("TestDeviceID");
this.facebookAdOneLayout.addView(this.facebookAdOne);
this.facebookAdOne.loadAd();
}
Now, I am also destroying facebook ad by calling destroy()
method in onPause, onDestroy and onStop
if (facebookAdOne != null) {
facebookAdOne.destroy();
}
I am also calling all super methods for onPause, onStop and onDestroy after calling Facebook's destroy method. So, when I exit activity by clicking back button, in my android monitor, I am getting an error message saying that,
Activity test.app.MainActivity has leaked IntentReceiver com.facebook.ads.internal.h$c@94eb1f that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity test.app.MainActivity has leaked IntentReceiver com.facebook.ads.internal.h$c@94eb1f that was originally registered here. Are you missing a call to unregisterReceiver()?
So can anyone tell me what to do? Where is the error? I tried a lot to find solution for this but couldn't get anything on web.
Thanks,