i have an admob-view at the bottom of my activity, the XML Looks like this:
<RelativeLayout
    android:id="@+id/ad_wrapper" 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">
    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>
</RelativeLayout>
so i'm not using a Fragment! I also tried this: How to avoid Admob blocking the UI thread. So my in my onCreate i do the following:
new Thread(new Runnable() {
    @Override
    public void run() {
        // TODO Auto-generated method stub
        AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
    }
}).run();
But the Problem stays the same. If i run my app with bad Network Connection my whole activity waits until the ad has finished loading. Sometimes this takes up to 20 seconds. So it Looks like he is blocking the UIThread. Maybe someone has a solution? It's really obfuscating because behind the Scenes Google Play Services must also use a Background Thread to establish a Network Connection to download the Ad so why is it blocking my UI?
Here the log filtered for ads:
01-01 15:26:55.960: D/dalvikvm(18253): open_cached_dex_file : /data/data/com.android.faccess/cache/ads-1555443625.jar /data/data/com.android.faccess/cache/ads-1555443625.dex
01-01 15:26:55.961: D/dalvikvm(18253): DexOpt: --- BEGIN 'ads-1555443625.jar' (bootstrap=0) ---
01-01 15:26:56.046: D/dalvikvm(18253): DexOpt: --- END 'ads-1555443625.jar' (success) ---
01-01 15:26:56.046: D/dalvikvm(18253): DEX prep '/data/data/com.android.faccess/cache/ads-1555443625.jar': unzip in 0ms, rewrite 84ms
01-01 15:26:56.074: I/Ads(18253): Use AdRequest.Builder.addTestDevice("8AF8C1D3A935E64B84C4CBBFDF5F33F7") to get test ads on this device.
01-01 15:27:12.351: I/dalvikvm(18253): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.o.a.evaluateJavascript
01-01 15:27:12.357: I/webkit/webview_proxy(18253): WebView() constructor=com.google.android.gms.ads.internal.o.a{41f75b30 VFE.HV.. ......I. 0,0-0,0}
01-01 15:27:12.390: I/webkit/webview_proxy(18253): Webview.loadDataWithBaseURL() this=com.google.android.gms.ads.internal.o.a{41f75b30 VFEDHVCL ......ID 0,0-960,150} baseUrl: http://googleads.g.doubleclick.net:80/mads/gma
Update
You are right guys, my UI isn't blocked. It's my Background Thread (AsyncTask) which is blocked.
onPreExecute is called and finished(!) immediatly but doInBackground has a delay about 5-20seconds till it is called if Network Connection is bad. What i noticed is that doInBackground starts immediatly after following logcat Messages:
01-02 02:23:23.289: E/NativeCrypto(16015): ssl=... cert_verify_callback ..._store_ctx=... arg=...
01-02 02:23:23.289: E/NativeCrypto(16015): ssl=... cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_ECDSA
01-02 02:23:23.889: E/NativeCrypto(16015): ssl=... cert_verify_callback ..._store_ctx=... arg=...
01-02 02:23:23.890: E/NativeCrypto(16015): ssl=... cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_ECDSA
I have only implemented Admob, Facebook for sharing Content and Google+ for sharing Content. What of These can cause this Problem, or generally when does a Native Crypto error log appears? Thank you for your help!
Update 2
Figured out the line which cause the Problem.. it's Facebook and his UILifeCycleHelper in my onCreate:
myLifeCycleHelper = new UiLifecycleHelper(this, null);
myLifeCycleHelper.onCreate(savedInstanceState);
the Problem is, Facebook recommends to instantiate the UILifeCycleHelper in onCreate.. if i comment that line out, everythink works with the expected Speed. So my final question, what is the solution to implement the LifeCycleHelper with the expected Speed, it doesn't block my UI, but it Looks like it's blocking my BackgroundThread.