title: How to use of In-app updates API in my app
body: <p>I found 2 links where I thought that it will be right but after the build of that code it showing nothing. I am adding one of two and recently build an app.</p>
  
  <p><a href="https://stackoverflow.com/questions/55939853/how-to-work-with-androids-in-app-update-api">Link have accepted answer but it is not running in my app and I am unable to find what I missed</a></p>
  
  <p><strong><em>Note:</em>-</strong> Code and link have different codes. </p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>public class TestingActivity extends AppCompatActivity {
  
      private static final String TAG = "ResTest";
  
      private CoordinatorLayout coordinatorLayout;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_testing);
  //        coordinatorLayout = findViewById(R.id.res_test);
          // Initialize AppUpdateManager. AppUpdateManager helps to Manages operations that allow your app to initiate its own updates.
          final AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(TestingActivity.this);
          // Requests the update availability for the current app, an intent to start an update flow, and, if applicable, the state of updates currently in progress.
          Task&lt;AppUpdateInfo&gt; appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
          // InstallStateUpdatedListener is listener that used to monitor updates installs.
          final InstallStateUpdatedListener installStateUpdatedListener = new InstallStateUpdatedListener() {
              @Override
              public void onStateUpdate(InstallState installState) {
                  // If successfully download then call popupSnackBarForCompleteUpdate() to show snackbar of successfully downloaded latest update.
                  if (installState.installStatus() == InstallStatus.DOWNLOADED) {
  //                    popupSnackBarForCompleteUpdate(coordinatorLayout, appUpdateManager);
                      Toast.makeText(TestingActivity.this, String.valueOf( appUpdateManager.completeUpdate()), Toast.LENGTH_SHORT).show();
                  }
              }
          };
          // 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 &amp;&amp;
                          // As it's flexible update so use FLEXIBLE.
                          appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
  
  //                    Log.d(TAG, "app here 1");
  
                      // Request the update.
                      try {
                          appUpdateManager.registerListener(installStateUpdatedListener);
                          // Starts the desired update flow(HERE is FLEXIBLE update).
                          appUpdateManager.startUpdateFlowForResult(appUpdateInfo, AppUpdateType.IMMEDIATE, TestingActivity.this, 100);
                      } catch (IntentSender.SendIntentException e) {
                          e.printStackTrace();
                      }
                  } else {
                      if (appUpdateInfo.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) {
                          popupSnackBarForCompleteUpdate(coordinatorLayout, appUpdateManager);
                      }
                  }
              }
          });
      }
  
  
      private static void popupSnackBarForCompleteUpdate(View view, final AppUpdateManager appUpdateManager) {
          Snackbar snackbar = Snackbar.make(view, "An update has just been downloaded.", Snackbar.LENGTH_INDEFINITE);
  
          snackbar.setAction("RESTART", new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  appUpdateManager.completeUpdate();
              }
          });
          snackbar.show();
      }
  
  }
  </code></pre>
  
  <p>When I build this code in debug I found nothing. No updation pop shown here while the app has been published in play-store.</p>
  
  <p><strong>What I want</strong></p>
  
  <p>Help to use In-App updates API in app and if you know so please explain a flow of in app updates API.</p>