2

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?

erginduran
  • 1,678
  • 5
  • 28
  • 51

1 Answers1

0

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.

Sriraman
  • 7,658
  • 4
  • 40
  • 60
mromer
  • 1,867
  • 1
  • 13
  • 18
  • 1
    how to check a new message If I cant use service when app is closed?how can I wake up the app on background without service?such as whatsapp,messenger.If There is a new message,send a new message.applications even when turned off – erginduran Aug 09 '14 at 19:21
  • you will have a Receiver where you will be able to manage that notification: start the server... or whatever – mromer Aug 09 '14 at 19:25
  • Can you open a little more so I do not understand? – erginduran Aug 09 '14 at 19:28
  • For example, http://developer.android.com/google/gcm/client.html. Here you can see notifications using google cloud messaging. They are using a GcmBroadcastReceiver to manage when you have a new message. So you will get a notification from server and you will have a BroadcastReceiver to manage that notification. There you can open your service. Sorry if I am not explaining well – mromer Aug 09 '14 at 19:34
  • Can I send notification via node.js server? – erginduran Aug 09 '14 at 19:48