简体   繁体   English

连接到Firebase的服务是个坏主意?

[英]Service connecting to Firebase a bad idea?

I am building an Android app that requires real time updates. 我正在构建一个需要实时更新的Android应用程序。 My server is Firebase. 我的服务器是Firebase。 Firebase is meant to receive its updated data when the user is connected to the server. Firebase用于在用户连接到服务器时接收其更新的数据。 I am very impressed with Firebase so far, however my concern is receiving the new data when the app is not active. 到目前为止,我对Firebase印象非常深刻,但是我关注的是当应用程序未处于活动状态时接收新数据。 I really do not want to try these ideas to find out they are a bad idea, for I am short on time. 我真的不想尝试这些想法,发现它们是个坏主意,因为我的时间很短。 I am looking for suggestions and advice. 我正在寻找建议和意见。

  • A service (example) . 服务(例子) Worried about battery consumption and going over my connection limit if users are always connected. 如果用户始终连接,则担心电池消耗并超过我的连接限制。
  • An AlarmManager to run a sync every X hours . 一个AlarmManager每隔X小时运行一次同步 Worried about not getting updates quickly enough. 担心没有足够快地获得更新。
  • Using GCM push notification to send a tickle . 使用GCM推送通知发送痒痒 Worried about paying for another service. 担心支付另一项服务。

Any other suggestions or possible issues I missed? 我错过了任何其他建议或可能的问题? Thanks for your time! 谢谢你的时间!

Edit 编辑

I found this thread . 我找到了这个帖子 Still unsure. 仍然不确定。 Maybe a service is not a bad idea, per James Tamplin (Suspect he is Firebase dev) 根据詹姆斯·坦普林(怀疑他是Firebase开发者),也许服务并不是一个坏主意

You probably want to use GCM in these situations. 您可能希望在这些情况下使用GCM。

Firebase works fine from a background service, but it leaves a socket open, so it's going to use quite a bit of power. Firebase可以在后台服务中正常工作,但它会打开一个套接字,所以它会使用相当多的功能。 This power usage is fine when a user is actively engaged with your app (the screen probably uses a lot more), but when it's running in the background, it's going to be hard on battery life. 当用户积极使用您的应用程序时(屏幕可能会使用更多),此功耗可以很好,但是当它在后台运行时,电池寿命会变得很困难。

In most cases, when your user isn't actively engaged, they're willing to accept slower response times, and push services like GCM are a better value in watts per user happiness. 在大多数情况下,当您的用户没有积极参与时,他们愿意接受较慢的响应时间,而像GCM这样的推送服务在每用户幸福的瓦数方面更有价值。

Also, Firebase is working on adding triggers, as demonstrated in this video from Google Cloud Platform Live , that will make it a lot easier to integrate with push services like GCM in the future. 此外,Firebase正在努力添加触发器,如Google Cloud Platform Live中的此视频所示 ,这将使将来与GCM等推送服务集成变得更加容易。

And I guess you could say James is a Firebase dev. 而且我想你可以说詹姆斯是Firebase开发者。 He's one of the co-founders :) 他是联合创始人之一:)

You could also try zapier.com which has a firebase + pushover integration to send gcm. 您也可以尝试使用firebase + pushover集成的zapier.com来发送gcm。 but it will require some spending.for free you will have to develop this your self on your custom server, using firebase queue. 但它需要一些支出。免费使用firebase队列,你必须在自定义服务器上开发自己。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM