title: Clear webview cache in broadcast receiver?
body: <p>I would like to clear the webview cache whenver a user updates my app. I have tried looking up at a lot of solutions but none seem to address this specifically.
  I have registered the broadcast receiver as follows.</p>
  
  <p><strong>Manifest file :</strong></p>
  
  <pre><code>&lt;receiver android:name=".UpdateReceiver"&gt;
      &lt;intent-filter  &gt;
              &lt;action android:name="android.intent.action.MY_PACKAGE_REPLACED" /&gt;
              &lt;data android:scheme="package" android:path="com.mypackage.com" /&gt;
          &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p><strong>Broadcast Receiver:</strong></p>
  
  <pre><code>public class UpdateReceiver extends BroadcastReceiver 
  {
  private WebView mWebview ;
  @Override
  public void onReceive(Context con, Intent intent)
   {
  
      mWebview = (WebView) findViewById(R.id.webView);
      CookieManager cookieManager = CookieManager.getInstance();
      cookieManager.removeAllCookie();
      mWebview.clearCache(true);
  }
  }
  </code></pre>
  
  <p>But, I cannot access the webview in the broadcast receiver. Any idea on how to get this done exactly? Maybe I'm getting something wrong.</p>
  
  <p>Thanks.</p>