没有Firebase的Android推送通知 [英] Android push notification without firebase
问题描述
我想发送android 推送通知给选定的用户,而无需使用 gcm或firebase.该应用程序已在没有Firebase的情况下构建.现在,我也需要集成推送通知.
I want to send android push notification to the selected user without using gcm or firebase. The application is already built without firebase. Now I need to integrate push notification too.
问题:
- 没有火力基地怎么可能?
实际上,我想要一个功能,当管理员更新特定用户的数据库表的one字段中的值时,该用户将获得有关更新的推送通知.怎么可能?
Actually I want a feature that, when an admin update the value in the one field in database table of particular user, the that user will get a push notification regarding the update. How it is possible?
推荐答案
方法是创建自定义服务 https://developer.android.com/reference/android/app/Service.html ,它通过套接字保持连接或按间隔轮询某些远程服务器.
The way is to create custom Service https://developer.android.com/reference/android/app/Service.html , which is holding connection via socket or polling some remote server with intervals.
但是,我建议Firebase服务在电池消耗方面,尤其是在利用睡眠模式方面,更为先进和优化.提供具有快速响应和CPU消耗的服务并非易事.我认为定制服务开发将导致对网络例程库进行本机(C ++)编码.
But, I suggest that Firebase service is more advanced and optimized in battery consumption and, particularly, in utilizing the sleep mode. It's not trivial to make a service which will have fast response and CPU consumption. I think that a custom service development will lead to native (C++) coding of networking routines libs.
此外,请考虑到Firebase提供了自己的身份验证服务,能够将您的匿名用户无缝转换为注册用户. Firebase服务有很多优点.缺点是:您的用户必须安装Google Play服务,如果您的应用会增长-您需要向Firebase付款.
Also, take into account that Firebase provides own Authentication service with ability to seamless convert your anonymous user to registered. There is a lot of pros of Firebase services. And cons are: your users have to install Google Play Services, if your app will grow - you will pay to Firebase.
这篇关于没有Firebase的Android推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!