【发布时间】:2018-06-17 07:38:15
【问题描述】:
我想在 iOS 上做一些推送警报
当用户在特定时间设置警报,并且服务器通过调用天气 API(例如 OpenweatherMap)在该时间发送天气数据。
是否可以在 Firebase 中使用云功能
【问题讨论】:
标签: ios firebase push-notification google-cloud-functions
我想在 iOS 上做一些推送警报
当用户在特定时间设置警报,并且服务器通过调用天气 API(例如 OpenweatherMap)在该时间发送天气数据。
是否可以在 Firebase 中使用云功能
【问题讨论】:
标签: ios firebase push-notification google-cloud-functions
是的,这可以通过请求模块来完成。
查看Use firebase cloud function to send POST request to non-google server,您会在哪里找到:
// import the module
var request = require('request');
// make the request
request('put your external url here', function (error, response, body) {
if (!error && response.statusCode == 200) {
//here put what you want to do with the request
}
})
请注意,您必须激活付费计划,因为免费计划(Spark 计划)仅允许“仅对 Google 拥有的服务的出站网络请求”
还请注意,您必须先安装请求包,然后才能如上所示调用它。
【讨论】: