title: Android Firestore view changes between snapshots from document
body: <p>We can view changes between snapshots from collection as <a href="https://firebase.google.com/docs/firestore/query-data/listen" rel="nofollow noreferrer">google official document</a> example:</p>
  
  <pre><code>db.collection("cities")
          .whereEqualTo("state", "CA")
          .addSnapshotListener(new EventListener&lt;QuerySnapshot&gt;() {
              @Override
              public void onEvent(@Nullable QuerySnapshot snapshots,
                                  @Nullable FirebaseFirestoreException e) {
                  if (e != null) {
                      Log.w(TAG, "listen:error", e);
                      return;
                  }
  
                  for (DocumentChange dc : snapshots.getDocumentChanges()) {
                      switch (dc.getType()) {
                          case ADDED:
                              Log.d(TAG, "New city: " + dc.getDocument().getData());
                              break;
                          case MODIFIED:
                              Log.d(TAG, "Modified city: " + dc.getDocument().getData());
                              break;
                          case REMOVED:
                              Log.d(TAG, "Removed city: " + dc.getDocument().getData());
                              break;
                      }
                  }
              }
          });
  </code></pre>
  
  <p>But if the query is on a document, how can we get the <code>DocumentChange</code> informations: ADDED/MODIFIED/REMOVED?</p>
  
  <pre><code>db.collection("cities")
          .document("SF") //Query on document "SF"
          .addSnapshotListener(new EventListener&lt;DocumentSnapshot&gt;() {
                  @Override
                  public void onEvent(@Nullable DocumentSnapshot documentSnapshot, @Nullable FirebaseFirestoreException e) {
              ....
              }
          });
  </code></pre>