Used this code.
Plugin version is 1.3.2
var options = {
"datePrefix": '__DATE:',
"fieldValueDelete": "__DELETE",
"fieldValueServerTimestamp": "__SERVERTIMESTAMP",
"persist": true,
"timestampsInSnapshots": true, // <-- set true
"config": {}
};
console.log("cordova.platformId: "+cordova.platformId);
if (cordova.platformId === "browser") {
options.config = {
apiKey: "my_apy_key",
authDomain: "localhost",
projectId: "my_project_id"
};
}
Firestore.initialise(options).then(function(db) {
// Add a second document with a generated ID.
db.collection("users").add({
first: "Alan",
middle: "Mathison",
last: "Turing",
born: 1912
})
.then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
.catch(function(error) {
console.error("Error adding document: ", error);
});
});
// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
this.receivedEvent('deviceready');
onceLoaded();
},
// Update DOM on a Received Event
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}