how to use socket.io with background service on an

2019-08-03 22:36发布

问题:

I use gottox/socket.io-java-client on android chat app.And Now I want to use socket.io as a background service.In chat app If a new message (when chat app is closed),send a notification like "new message on chat app-click here if you want to see. How can I do that? I did a chat app with node.js,gottox on android.But I need this app work as a background service on phone.Do you have any plugins or examples?

回答1:

A service or any other Android component can be closed by the operating system. The solution is to use Android notifications to wake up any component.