|
13 | 13 | import com.google.firebase.firestore.CollectionReference; |
14 | 14 | import com.google.firebase.firestore.DocumentChange; |
15 | 15 | import com.google.firebase.firestore.DocumentChange.Type; |
16 | | -import com.google.firebase.firestore.DocumentListenOptions; |
17 | 16 | import com.google.firebase.firestore.DocumentReference; |
18 | 17 | import com.google.firebase.firestore.DocumentSnapshot; |
19 | 18 | import com.google.firebase.firestore.EventListener; |
|
23 | 22 | import com.google.firebase.firestore.FirebaseFirestoreException; |
24 | 23 | import com.google.firebase.firestore.FirebaseFirestoreSettings; |
25 | 24 | import com.google.firebase.firestore.ListenerRegistration; |
| 25 | +import com.google.firebase.firestore.MetadataChanges; |
26 | 26 | import com.google.firebase.firestore.Query; |
27 | 27 | import com.google.firebase.firestore.Query.Direction; |
28 | 28 | import com.google.firebase.firestore.QueryDocumentSnapshot; |
@@ -677,11 +677,8 @@ public void onEvent(@Nullable DocumentSnapshot snapshot, |
677 | 677 | public void listenWithMetadata() { |
678 | 678 | // [START listen_with_metadata] |
679 | 679 | // Listen for metadata changes to the document. |
680 | | - DocumentListenOptions options = new DocumentListenOptions() |
681 | | - .includeMetadataChanges(); |
682 | | - |
683 | 680 | DocumentReference docRef = db.collection("cities").document("SF"); |
684 | | - docRef.addSnapshotListener(options, new EventListener<DocumentSnapshot>() { |
| 681 | + docRef.addSnapshotListener(MetadataChanges.INCLUDE, new EventListener<DocumentSnapshot>() { |
685 | 682 | @Override |
686 | 683 | public void onEvent(@Nullable DocumentSnapshot snapshot, |
687 | 684 | @Nullable FirebaseFirestoreException e) { |
|
0 commit comments