title: Migrate from FirebaseInstanceId.getInstance().getId() to FirebaseInstallations.getInstance().getId()
body: <p>I have to migrate from the deprecated synchronous api <code>FirebaseInstanceId.getInstance().getId();</code> to the new async firebase api:</p>
  <pre><code>FirebaseInstallations.getInstance().getId().addOnCompleteListener( task -&gt; {
                                  if (!task.isSuccessful()) {
                                      Log.w(TAG, &quot;getInstanceId failed&quot;, task.getException());
                                      return;
                                  }
                                  // Get new Instance ID 
                                  String id = task.getResult();
                              });
  </code></pre>
  <p>My problem is that in my old project, in many different point of my code a method like the following one has being called, and all the called expecting a response synchrounus in-line without callback:</p>
  <pre><code>public static String getDeviceId() {
      if (deviceId == null) {
          initDeviceId();
      }
      return deviceId;
  }
  
  private static void initDeviceId() {
      deviceId = FirebaseInstanceId.getInstance().getId();
  }
  </code></pre>
  <p>How can migrate the code without rewriting all the project ?
  I have thought to to edit the above methods in this way:</p>
  <pre><code>public static String getDeviceId() {
      if (deviceId == null) {
          deviceId = workerThread.submit(initDeviceId()).get()
      }
      return deviceId;
  }
  
  private fun initDeviceId():Callable&lt;String?&gt;{
      return Callable {
          val latch = CountDownLatch(1)
          var result:String ?= null
          FirebaseInstallations.getInstance().id.addOnCompleteListener{ 
              task -&gt; result = task.result
                      latch.countDown()
          }
          
          latch.await()
          result
      }
  }
  </code></pre>
  <p>but in this way I risk to block mainthread.</p>