joe*_*oel 2 github intellij-idea firebase firebase-realtime-database
我从这里克隆了一个firebase样本
https://github.com/firebase/quickstart-js
我想运行这个示例,我已经尝试过itellij和gitbash,但它没有运行
gio*_*r91 14
消息传递示例
npm install -g firebase-tools可能需要sudo).firebase login.这将打开您的浏览器并让您登录到您的Google帐户.git clone https://github.com/firebase/quickstart-js.gitcd quickstart-jsCreate new projectAdd Firebase to your web application并复制提示给您的javascript代码.index.html在messaging文件夹中打开,在第83行打开从仪表板复制的代码.firebase init在messaging文件夹中键入命令,然后回答将要问您的问题:
What Firebase CLI features do you want to setup for this folder?
--> Hosting: Configure and deploy Firebase Hosting sites
What file should be used for Database Rules?
--> Blank, it is not relevant for this example.
What do you want to use as your public directory? (public)
--> .
Configure as a single-page app (rewrite all urls to /index.html)?
--> y
File ./index.html already exists. Overwrite?
--> N
Run Code Online (Sandbox Code Playgroud)键入命令firebase serve -p 8081(或您拥有的任何其他空闲端口)
Request permission(如果操作成功,将显示注册令牌)类型
curl -X POST -H "Authorization: key=YOUR-SERVER-KEY" -H "Content-Type:
application/json" -d '{
"notification": {
"title": "Portugal vs. Denmark",
"body": "5 to 1",
"icon": "firebase-icon.png",
"click_action": "http://localhost:8081"
},
"to": "YOUR-IID-TOKEN"
}' "https://fcm.googleapis.com/fcm/send"
Run Code Online (Sandbox Code Playgroud)
更换YOUR-SERVER-KEY用复制的服务器密钥,并YOUR-IID-TOKEN用字符串出现在这里点击后Request permission.如果一切正确完成,则会在此表单的本地页面中显示通知
Received message:
{
"from": "xxxxxxxxxx",
"collapse_key": "do_not_collapse",
"notification": {
"title": "Portugal vs. Denmark",
"body": "5 to 1",
"icon": "firebase-icon.png",
"click_action": "http://localhost:8081"
}
}
Run Code Online (Sandbox Code Playgroud)数据库示例
您无需运行,firebase init因为该firebase.json文件已存在并已在存储库中配置.但如果你想使用它,你必须:
head部分粘贴凭据(与上一步骤7相同)index.html.quickstart-js/database文件夹类型命令中firebase serve,应用程序将加载到此页面.Sign in with Google,键入您的凭据,然后享受它!:-)Auth示例
您无需运行,firebase init因为该firebase.json文件已存在并已在存储库中配置.要使用它(我没有尝试过),例如你应该:
facebook-credentials.html到head部分script页面末尾的部分粘贴<YOUR_FACEBOOK_APP_ID>quickstart-js/auth命令firebase serve,应用程序将加载到此页面.Facebook Login using OAuth Credentials (via Facebook Login Button)登录.如果你想使用其他的方法,你就必须修改相应的文件,以同样的方式(facebook-popup.html,facebook-redirect,等)
随意询问是否不清楚.
| 归档时间: |
|
| 查看次数: |
1803 次 |
| 最近记录: |