Tag: Firebase

向公众公开Firebase apiKey是否安全?

Firebase Web-App指南指出,我应该把给定的apiKey放到我的Html中来初始化Firebase: // TODO: Replace with your project's customized code snippet <script src="https://www.gstatic.com/firebasejs/3.0.2/firebase.js"></script> <script> // Initialize Firebase var config = { apiKey: '<your-api-key>', authDomain: '<your-auth-domain>', databaseURL: '<your-database-url>', storageBucket: '<your-storage-bucket>' }; firebase.initializeApp(config); </script> 通过这样做,apiKey就暴露给每个访问者。 这个钥匙的目的是什么?它真的是公开的吗?

Firebase android:使用户名唯一

parsing将在今年年底closures,所以我决定开始使用Firebase。 我需要实现一个注册过程,有3个字段:电子邮件,用户名,密码( 电子邮件和用户名必须是唯一的我的应用程序)。 由于Firebase不提供简单的方式来pipe理像Parse这样的用户名,我决定只使用电子邮件/密码注册并保存一些额外的数据,如用户名。 这里是我的用户数据结构: app : { users: { "some-user-uid": { email: "test@test.com" username: "myname" } } } 但是,我想要做的是使用户名独特,并在创build一个帐户之前检查它。 这些是我的规则: { "rules": { ".read": true, ".write": true, "users": { "$uid": { ".write": "auth !== null && auth.uid === $uid", ".read": "auth !== null && auth.provider === 'password'", "username": {".validate": "!root.child('users').child(newData.child('username').val()).exists()"} } } } } […]

当应用程序从多任务托盘停止时,Android应用程序未收到Firebase通知

我已经阅读了类似的问题 ,但是我无法从中得到正确的答案。 我有一个系统,我们发送通知大约500个设备。 不幸的是,这些设备中有很多没有收到通知。 我发现OPPO F1系列手机特别没有收到通知。 我发现如果应用程序从多任务托盘中停止,则会发生这种情况。 我如何解决这个问题? [更新:我观察到,当我从任务托盘closures应用程序,我的应用程序被迫停在应用程序pipe理器。 而当我从任务托盘closuresWhatsApp时,它仍然不会被迫停止。 Whatsapp如何处理?]

在Firebase侦听器中设置Singleton属性值

目前,我正在testingFirebase以及计划在整个应用生命周期中使用的Singleton模型。 我现在坚持的东西似乎很微不足道,但我无法弄清楚我的生活。 我有一个我使用的模型示例:Firebase中的书签。 public class BookSingleton { private static BookSingleton model; private ArrayList<BookMark> bookmarks = new ArrayList<BookMark>(); public static BookSingleton getModel() { if (model == null) { throw new IllegalStateException("The model has not been initialised yet."); } return model; } public ArrayList<Bookmark> theBookmarkList() { return this.bookmarks; } public void setBookmarks(ArrayList<Bookmark> bookmarks){ this.bookmarks = bookmarks; } […]

如何获得所有图片的数组?

我正在努力上传图像,一切都很好,但我有100张图片,我想在我的视图中显示它们,因为我得到的文件夹中的图像的完整列表,我无法find新的API这个选项。

使用安全规则限制子/字段访问

我正在编写一个应用程序,允许用户提交在被显示给其他用户之前进行审核的提名。 这要求我在实施安全规则方面迄今尚未成功的一些限制: 隐藏任何尚未获得批准的提名 隐藏提交的私人字段(电话,审批状态,创builddate等) 我目前的规则如下: { "rules": { "nominations": { ".read": true, "$nominationId": { ".read": "data.child('state').val() == 'approved' || auth != null", // Only read approved nominations if not authenticated ".write": "!data.exists()", // Only allow new nominations to be created "phone": { ".read": "auth != null" // Only allow authenticated users to read phone number […]

如何在Firebase中的后台应用中处理通知

这是我的清单 <service android:name=".fcm.PshycoFirebaseMessagingServices"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <service android:name=".fcm.PshycoFirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> 当应用程序在后台,通知到达时,默认通知来,并不会运行我onMessageReceived代码。 这是我的onMessageReceived代码。 这将调用如果我的应用程序在前台运行,而不是在后台应用程序。 如何在应用程序在后台运行此代码? // [START receive_message] @Override public void onMessageReceived(RemoteMessage remoteMessage) { // TODO(developer): Handle FCM messages here. // If the application is in the foreground handle both data and notification messages here. // Also if you […]

基于firebase中多个where子句的查询

{ "movies": { "movie1": { "genre": "comedy", "name": "As good as it gets", "lead": "Jack Nicholson" }, "movie2": { "genre": "Horror", "name": "The Shining", "lead": "Jack Nicholson" }, "movie3": { "genre": "comedy", "name": "The Mask", "lead": "Jim Carrey" } } } 我是Firebase新手。 如何从上面的数据中检索genre = 'comedy' AND lead = 'Jack Nicholson' ? 我有什么select?

如何在Firebase上存储和查看图像?

如何在Firebase上存储和查看图像?

如何使用Firebase Cloud Messaging将设备发送到设备消息?

在搜索文档后,我找不到任何有关如何使用FCM将设备发送到设备消息的信息,而无需使用外部服务器。 例如,如果我正在创建一个聊天应用程序,我需要发送推送通知给用户关于未读消息,因为他们不会一直在线,我不能有一个永远连接到后台的持久服务实时数据库,因为这将是太重的资源。 那么当某个用户“B”向他/她发送聊天消息时,如何向用户“A”发送推送通知? 我需要一个外部服务器吗?还是只能使用Firebase服务器来完成?