Java – block network calls from SDK Android App

I'm using Google's AdMob SDK, and some kind of initialization occurs during application startup, which basically leads to virtual calls (virtual responses from Google) Just to recommend and improve the performance of advertising in our application Google, we recommend using this path Specifically, this is what they suggest to add to the app

PublisherAdView mAdView = new PublisherAdView (this);
mAdView.setAdUnitId( this.getResources().getString(R.string. banner_ad_unit_id));
mAdView.setAdSizes(AdSize. BANNER,AdSize.MEDIUM_RECTANGLE);
PublisherAdRequest adRequest = new PublisherAdRequest.Builder().build();
mAdView.loadAd(adRequest);

Now, before making the real ad call, it will make the virtual ad call and provide us with the improved performance of the real ad call

Question: this now leads to additional Internet calls. Google says they will actually charge us, which is an additional burden for us

Now, in order to solve this problem, we tested a scenario. We blacklisted the virtual advertisement call sent by the AdMob SDK, and we still improved the performance This is done through the agent. We specifically prevent this advertisement from calling URL

Now my question is, is there a way to solve this problem? I'm looking for a way to basically disconnect after making a call The SDK made a request, but it never reached the Google server in our android app

Solution

Solution 1: –

The problem may be that you use mixed Java / XML methods to do the same thing You have to delete all Java and pure XML, it will work properly

Solution 2: –

Check the logcat output when testing on the device This may occur due to network connectivity problems Also note that settesting only requests test ads (virtual Google ads) on the simulator, and it is not recommended to use addtestdevice (adrequest. Test_emulator) or addtestdevice ("your_device_id_found_in_logcat_when_making_a_request_on_a _device") I hope it will help you

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>