我有一個帶有 Firebase 數據庫的 android 應用程序,其中我將 node.js 與 Cloud Firestore 連接起來。下面是節點中的代碼:
const admin = require('firebase-admin');
const serviceAccount = require('./ServiceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
const db = admin.firestore();
admin
.firestore()
.collection("email_collection")
.add({
to: "[email protected]",
message: {
subject: "Hello from Firebase!",
text: "This is the plaintext section of the email body.",
html: "This is the <code>HTML</code> section of the email body.",
},
})
.then(() => console.log("Queued email for delivery!"));
我已經通過從終端運行服務器(手動)對其進行了測試,並成功收到了電子郵件。
現在我的問題是:如何從 android 應用程序運行服務器?換句話說,應用程序中有一個按鈕,我怎樣才能讓用戶(當他點擊那個按鈕時)用一些數據(如電子郵件地址)觸發節點,然後通過雲 Firestore 發送電子郵件?
我想你可能正在尋找可調用的雲函數
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句