firebase-admin

How to compare firebase timestamps?

我的未来我决定 提交于 2020-04-16 03:19:20
问题 I have cloud function code code like this: console.log(`ts: ${(element.get('expire') as admin.firestore.Timestamp).toDate().toUTCString()} now: ${admin.firestore.Timestamp.now().toDate().toUTCString()}`) const greater = (element.get('expire') as admin.firestore.Timestamp) > admin.firestore.Timestamp.now() const lower = (element.get('expire') as admin.firestore.Timestamp) < admin.firestore.Timestamp.now() console.log(`greater: ${greater} lower: ${lower}`) In console: ts: Mon, 08 Apr 2019 20:59

Firebase Admin SDK Android

此生再无相见时 提交于 2020-04-14 07:19:01
问题 Code for Initialising Firebase-Admin SDK in Android @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_excel); FileInputStream serviceAccount = null; try { serviceAccount = new FileInputStream("android.resource://com.app.hello/raw/hello.json"); } catch (FileNotFoundException e) { e.printStackTrace(); } FirebaseOptions options = null; try { options = new FirebaseOptions.Builder() .setCredentials(GoogleCredentials

Cloud Functions for Firebase - write to database when a new user created

匆匆过客 提交于 2020-04-09 08:15:36
问题 I am pretty new Cloud Functions for Firebase and the javascript language. I am trying to add a function every time a user created to write into the database. This is my code: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.addAccount = functions.auth.user().onCreate(event => { const user = event.data; // The firebase user const id = user.uid; const displayName = user.displayName; const photoURL

Cloud Functions for Firebase - write to database when a new user created

我怕爱的太早我们不能终老 提交于 2020-04-09 08:13:25
问题 I am pretty new Cloud Functions for Firebase and the javascript language. I am trying to add a function every time a user created to write into the database. This is my code: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.addAccount = functions.auth.user().onCreate(event => { const user = event.data; // The firebase user const id = user.uid; const displayName = user.displayName; const photoURL

Cloud Functions for Firebase - write to database when a new user created

时光怂恿深爱的人放手 提交于 2020-04-09 08:11:02
问题 I am pretty new Cloud Functions for Firebase and the javascript language. I am trying to add a function every time a user created to write into the database. This is my code: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.addAccount = functions.auth.user().onCreate(event => { const user = event.data; // The firebase user const id = user.uid; const displayName = user.displayName; const photoURL

Cloud Functions for Firebase - write to database when a new user created

别说谁变了你拦得住时间么 提交于 2020-04-09 08:10:20
问题 I am pretty new Cloud Functions for Firebase and the javascript language. I am trying to add a function every time a user created to write into the database. This is my code: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.addAccount = functions.auth.user().onCreate(event => { const user = event.data; // The firebase user const id = user.uid; const displayName = user.displayName; const photoURL

Cloud Functions for Firebase - write to database when a new user created

主宰稳场 提交于 2020-04-09 08:06:31
问题 I am pretty new Cloud Functions for Firebase and the javascript language. I am trying to add a function every time a user created to write into the database. This is my code: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.addAccount = functions.auth.user().onCreate(event => { const user = event.data; // The firebase user const id = user.uid; const displayName = user.displayName; const photoURL

Firebase Firestore Query Between Two Timestamps

你。 提交于 2020-04-07 10:31:06
问题 I want to find events that are a on now and upcoming (next 30 days) but that are also not in the past. When i run this as a cloud function, I get "Cannot have inequality filters on multiple properties". How am I meant to get this type of data. (ignore the fact that the date stuff is a bit messy, am still playing around). // Create date 30 days in future const searchData: Date = new Date(); searchData.setDate(searchData.getDate() + 30); // Load data and handle empty respoonse const response:

Firebase Firestore Query Between Two Timestamps

不羁岁月 提交于 2020-04-07 10:28:48
问题 I want to find events that are a on now and upcoming (next 30 days) but that are also not in the past. When i run this as a cloud function, I get "Cannot have inequality filters on multiple properties". How am I meant to get this type of data. (ignore the fact that the date stuff is a bit messy, am still playing around). // Create date 30 days in future const searchData: Date = new Date(); searchData.setDate(searchData.getDate() + 30); // Load data and handle empty respoonse const response:

How to specify sound and click_action in firebase cloud function

你离开我真会死。 提交于 2020-03-22 09:06:09
问题 I tried with the following function (node.js v8): exports.sendComNotification = functions.firestore .document('Comunicados/{comID}') .onUpdate((snap, context) => { console.log('Com triggered'); const newValue = snap.after.data(); const msg = newValue.title; var message = { notification: { title: 'Comunicado da Diretoria!', body: msg, badge: '1', sound: 'default', click_action: 'FLUTTER_NOTIFICATION_CLICK', }, topic: "Comunicados" }; return admin.messaging().send(message) .then((response) => {