title: CookieManager.getCookie() always returns null (Version <= API 28 (Pie))
body: <p>I use a standard <code>android.webkit.Webview</code> in a Java-Based native android app.
  Inside the Webview the User logs into a webapp. After successful login the webapp stores a cookie with the access token. I want to <em>access</em> this cookie.</p>
  <p>The cookie has the following characteristics:</p>
  <ul>
  <li>HTTPS Url Structure like: <code>https://api.example.com</code></li>
  <li><code>httpOnly</code> Flag</li>
  <li><code>Secure</code> Flag</li>
  </ul>
  <p>When on Android API Level 29 or API Level 30, calling <code>CookieManager.getCookie(&quot;https://api.example.com&quot;)</code> works like expected and returns a String containing the Value of the Cookie.</p>
  <p>When on Android API Level 28 or lower, calling the same method <em>always</em> returns <code>null</code>. Nevertheless calling the <code>CookieManager.hasCookies()</code> returns <code>true</code> and the fact that the webapp in <code>Webview</code> is working as expected shows that the cookie <em>must</em> exist somewhere.</p>
  <p>I need to persist the cookie for handling &quot;external&quot; Downloads and other API Calls not executed within the Webview.</p>
  <p><strong>Why is this not working below API 28 and how can I solve it?</strong></p>
  <p>Things already tried:</p>
  <ul>
  <li>Calling the method <code>CookieManager.getCookie(&quot;https://api.example.com&quot;)</code> on different event hooks from <code>WebChromeClient</code>, <code>WebViewClient</code> (e.g. <code>onPageStarted</code>, <code>onPageFinished</code>, <code>onProgressChanged</code>, <code>shouldInterceptRequest</code>, <code>shouldOverrideUrlLoading</code>)</li>
  <li>Flushing the cookies from memory to persistent storage using <code>CookieManager.flush()</code> in different places.</li>
  <li>Extracting the cookie by intercepting traffic (this is too hacky using existing hooks)</li>
  </ul>
  <p>Assumptions:</p>
  <ul>
  <li>Threading?, API Support below 28 incomplete?</li>
  </ul>