I want to integrate ad to my app, but the problem is that the
MobileAds.initialize(this){ initStatus-> not work this method( onCreateView)
But I am use this method( onCreate:
MobileAds.initialize(this){ initStatus-> this working... Activity class,
But I want to use when I add ads to a fragment instead of an activity.
Can anyone tell me the working code for it?
I had tried some methods, but they didn't work. If the code is placed in an activity it works correctly
Here is the code I tried for Fragment:
You can use this in fragment by giving the context of activity.
Update your code:-
To:-
or you can initialize an activity variable in the fragment once the fragment is attached to the activity.