title: Google Application Update - Regarding Immediate Update for the Android Live Application
body: <p>I am following below link to provide app update experience or feature in my android live application.</p>
  
  <p>The link is here : <a href="https://developer.android.com/guide/playcore/in-app-updates#java" rel="nofollow noreferrer">https://developer.android.com/guide/playcore/in-app-updates#java</a></p>
  
  <p>From the link content, I am implementing Immediate App Update feature. </p>
  
  <p>So far, I have done as below steps :</p>
  
  <ol>
  <li>Downgraded my application version and version code as well.</li>
  <li>Generated new Release APK and Insalled it in my Android device.</li>
  <li>Added below code for the App update functionality in my Splash Activity.</li>
  </ol>
  
  <p>Implemented below Code : </p>
  
  <p>First added dependency : <code>implementation 'com.google.android.play:core:1.7.1'</code></p>
  
  <p>Then, In Splash Activity,</p>
  
  <pre><code>        // Creates instance of the manager.
          final AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(SplashActivity.this);
  
          // Returns an intent object that you use to check for an update.
          Task&lt;AppUpdateInfo&gt; appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
  
          // Checks that the platform will allow the specified type of update.
          appUpdateInfoTask.addOnSuccessListener(new OnSuccessListener&lt;AppUpdateInfo&gt;() {
              @Override
              public void onSuccess(AppUpdateInfo appUpdateInfo) {
                  if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
                          // For a flexible update, use AppUpdateType.FLEXIBLE
                          &amp;&amp; appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
                      // Request the update.
                      try {
                          appUpdateManager.startUpdateFlowForResult(appUpdateInfo, AppUpdateType.IMMEDIATE, SplashActivity.this,500);
                      } catch (IntentSender.SendIntentException e) {
                          e.printStackTrace();
                      }
                  }else
                  {
                    //Continuing with the Application flow
                  }
               }
  </code></pre>
  
  <p><strong>The Issue is:</strong> When I have generated Signed APK and installed in My android device.</p>
  
  <p>Getting below error in log : </p>
  
  <pre><code> Auth: [GoogleAccountDataServiceImpl] getToken() -&gt; BAD_AUTHENTICATION. Account: &lt;ELLIDED:9494777414&gt;, App: com.google.android.gms, Service: oauth2:https://www.googleapis.com/auth/emeraldsea.mobileapps.doritos.cookie
  </code></pre>
  
  <p>What might be the Issue ? </p>