Open amo222lpatil opened 6 years ago
i am using your below code in appcelerator
var FirebaseCore = require('firebase.core'); FirebaseCore.configure(); var FirebaseDatabase = require('firebase.database'); // Inserting values in firebase database var fdRef = FirebaseDatabase.getReference().childByAutoId({ path: 'user' }); fdRef.setValue({ username: 'username', email: 'test@example.com', password: 'ABCXYZ', timestamp: FirebaseDatabase.getFirebaseServerTimestamp() }, function(e) { Ti.API.info('Value written, snapshot: ' + JSON.stringify(e, null, 4)); }); // Fetching values from Firebase database var userRef = FirebaseDatabase.getReference({ path: 'user', observableEvents: [FirebaseDatabase.DATA_EVENT_TYPE_CHILD_ADDED, FirebaseDatabase.DATA_EVENT_TYPE_VALUE] }); userRef.addEventListener('value', function(e) { Ti.API.info('DATA_EVENT_TYPE_VALUE, snapshot: ' + JSON.stringify(e, null, 4)); }); userRef.addEventListener('add', function(e) { Ti.API.info('DATA_EVENT_TYPE_CHILD_ADDED, snapshot: ' + JSON.stringify(e, null, 4)); });
But i didnt get What value should i assign to "path" variables in FirebaseDatabase.getReference().childByAutoId() method. Does it is collection name in firebase project ?
i am using your below code in appcelerator
But i didnt get What value should i assign to "path" variables in FirebaseDatabase.getReference().childByAutoId() method. Does it is collection name in firebase project ?