英文:
Push notifications from Web server to android application
问题
大家好,正在查看这个问题的所有人。我认为这个问题可能相当抽象,但是通过谷歌搜索我找不到正确的答案。
我正在尝试制作一个类似星巴克Siren-Order的应用程序。
我们的Android应用程序是用Android-Java
制作的,我们还正在开发一个Web服务器,也是用Java
编写的,使用Spring-MVC
。
一旦客户使用这个应用程序(为客户)下订单,我想在Store-Owner-Application
中显示推送通知。我考虑使用WebSocket,但在这种情况下,Firebase是否是WebSocket的一个很好的替代品?我以前都没有使用过WebSocket或Firebase。只是想要一些提示和建议。谢谢
英文:
Hello to everyone who is viewing this question. I think this question might be quite abstract, but I couldn't find the correct answer by googling.
I am trying to make an application like Starbucks Siren-Order.
Our android applications are made in Android-Java
, and we are also developing a web-server which is also
written in Java
, using Spring-MVC
.
Once a customer makes an order using this application(which is for customers), I want to make push notifications appear in Store-Owner-Application
. I was thinking about using WebSocket, but is Firebase a great alternative for websocket in this case? I never used neither WebSocket or Firebase before.
Just asking for some tips and advice. Thank you
答案1
得分: 4
在简单的情况下,Firebase是一个比自己使用WebSocket实现更好的选择。
这是因为Firebase已经拥有一个不断开的耗电量的开放式套接字来处理其通知,由于大多数应用程序使用它而不是创建新的套接字,它有助于节省电池和其他资源。
不过也有一些例外情况...
Firebase并不完美,它允许在大多数情况下向客户端发送消息,但在某些情况下,您的通知可能会延迟或根本无法传递。
例如:
- 如果电池电量低
- 如果设备最近接收了许多推送通知
如果您需要一个简单的99%解决方案来发送推送通知,而且易于实施并且不会浪费电量 - 选择Firebase。
如果您必须对通知拥有完全控制权,并且需要它们尽快全部送达,可以考虑自行实现。
英文:
in simple cases, Firebase is a much better alternative to implementing it yourself using WebSocket.
That's because Firebase already has a battery draining constantly open socket to handle its notifications, and since most apps use it rather than creating a new socket, it helps conserve battery and other resources.
There are a few exceptions though..
Firebase isn't perfect, it allows sending messages to the client most of the time, and in some cases, your notification will be delayed, or won't get delivered at all.
For example:
- If the battery is low
- if the device received many push notifications recently
If you need a simple 99% solution to sending push notifications that is easy to implement and won't waste battery - Go with Firebase.
If you have to have full control over your notifications and need them delivered all the time, as soon as possible, consider implementing it yourself.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论