title: while updating a new version app is updating to the newer version but need to manually clear data
body: <p>Say "My android application is running on my server properly. now I want to update my application. while  I'm updating my application older version taking the newer version but need to clear the data from settings manually. As I can't tell so  many users to do that, so how can I solve this problem programmatically?"</p>
  
  <p>like in manifest I add   below receiver code </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /&gt;
     &lt;uses-permission
          android:name="android.permission.CLEAR_APP_CACHE"
          tools:ignore="ProtectedPermissions"/&gt;
  
  
  
  &lt;receiver android:name=""&gt;
           &lt;intent-filter android:priority="100"&gt;
  &lt;action android:name="android.intent.action.PACKAGE_INSTALL"/&gt;
  &lt;action android:name="android.intent.action.PACKAGE_ADDED"/&gt;
  &lt;action android:name="android.intent.action.PACKAGE_REMOVED"/&gt;
  &lt;data android:scheme="package"/&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  </code></pre>
  
  <p>Then I added the clearing data code .</p>
  
  <p>I expect that while app is installing to the newer version the data will be cleared and the application will run smoothly.</p>
  
  <p>But it is  clearing data showing me the toast, still I need to clear data manually for entering the application.</p>