简体   繁体   中英

Sending Notifications to android app? How to implement server-side (own server, FCM)?

I come from the JavaEE development and I'm totally new to android app developement and I'm a bit confused how to implement my requirements. I have a server, where the user has to authetificate and can perform CRUD-Operations via REST-webservice. When a specific event is triggered server-side I want to send a notification to the app. The user should recive the notification even when the app is not running at the moment.

So now my questions:

  • What do I need on client side so I can recieve this notifications even when the app is not running? Or do I recieve them even if the app is not running? The data input from the notification needs to be safed app-side.

  • How do I send a notification from my server if the event is triggered? Do I have to use FCM(/GCM?) or can I directly send notifications from my server to the app?

Any help is appreciated!

Typically, 'instant notifications' are done via websocket severs, for mitigating the process of setting one up yourself, people typically use something like Pusher, which has a library available for java, or you can obviously use FCM/GCM. In conjunction with this document you should be able to keep the service running on the andriod app even when running in the backround so you can still send notifications, just remember you'll have to still attempt to detect if they have internet connection or not when sending out those notifications.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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