连接到Firebase的服务不好主意? [英] Service connecting to Firebase a bad idea?

查看:107
本文介绍了连接到Firebase的服务不好主意?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个需要实时更新的Android应用程序。我的服务器是Firebase。当用户连接到服务器时,Firebase旨在接收其更新的数据。到目前为止,我对Firebase留下了非常深刻的印象,但是我担心在应用程序不活跃时收到新的数据。我真的不想尝试这些想法,发现他们是一个坏主意,因为我时间不够。我正在寻找建议和建议。





我错过了其他建议或可能的问题吗?感谢您的时间!



编辑



我发现 this thread 。仍然不确定。也许一个服务不是一个坏主意,根据詹姆斯坦普林(嫌疑人他是Firebase的开发人员)解决方案

您可能想要使用GCM在这种情况下。

Firebase可以在后台服务中正常工作,但是会打开一个套接字,所以会使用相当多的功能。当用户积极地使用你的应用程序(这个屏幕可能使用了更多)时,这个用电量是很好的,但是当它在后台运行时,电池寿命将会很难。在大多数情况下,当用户没有主动参与时,他们愿意接受较慢的响应时间,像GCM这样的推送服务是一个更好的价值,单位为瓦特/瓦特用户的快乐。

此外,Firebase正在努力添加触发器,如,这将使未来与GCM等推送服务整合变得更容易。

我想你可以说詹姆斯是一名Firebase开发人员。他是联合创始人之一:)

I am building an Android app that requires real time updates. My server is Firebase. Firebase is meant to receive its updated data when the user is connected to the server. I am very impressed with Firebase so far, however my concern is receiving the new data when the app is not active. 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. Worried about not getting updates quickly enough.
  • Using GCM push notification to send a tickle. 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)

解决方案

You probably want to use GCM in these situations.

Firebase works fine from a background service, but it leaves a socket open, so it's going to use quite a bit of power. 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.

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.

And I guess you could say James is a Firebase dev. He's one of the co-founders :)

这篇关于连接到Firebase的服务不好主意?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆