When the application is closed, I want to receive messages with the socket.io
How do I do this?
Related
i need to make an app on android wear that when a button is clicked, a message is sent to mobile. If i made an app that is listening on mobile, then all found 100%. But if i close the app on mobile the message cannot be received. How can i make a service in background that listen for message sent from my wear app?
You need to use a WearableListenerService in your mobile app; once you register such service in your mobile app and its manifest, then messages can be routed to that service even if your app is not running.
I'm working on an app that is very simple (it's a chat app)
I have a server and Android users.
for example say we have 2 users, user_a and user_b.
user_a enters a chat room and sends "hi user_b" (user_b is registered to this chat room)
when user_a sends his message, it is also sent to the server.
I'd like to make a service that will be running always in the background even when the app isn't running. that service will check for new updates each time.
so I'd like user_b to receive the message, and it will appear as notification.
in order to do it my approach is to make a service that will continuesly run in the background. any suggestions?
The best way to do this is sending messages to your server, which will notify recipients via GCM in real-time. You need to create a gcm intent service so you can catch gcm messages and handle them properly in your app (build a notification and updating chat activity)
You can also broadcast the messages you receive from gcm notifications so you update your chat online (like all chat apps do…)
I recommend you to read about GCM and broadcast
As the app disconnects it stops getting messages from xmpp server. For background notification purpose, I am using GCM service. Now, Just like WhatsApp I want my app too to receive the messages in background and save them in sqlite.
Is it necessary for this task that my app would always be connected to
xmpp server?
Will it not load the xmpp server Since, so many sessions the server
will have to keep alive?
Don't set keep alive for less then 10 minutes this will load the server.
When app is in the background then you have to send push notification via gcm for android and apns for iPhone. For this to implement you need to implement plugin on openfire.
1 up if you like the answer. Email me at cvofjaspreet#gmail.com I can provide you code for plugin also.
I am implementing a chat app using asmack library. I want to start a always running service where all the connection management task is to be done and that should be keep on receiving the incoming packets and saving the messages in my sqlite database. And as my app is launched I want my app to be notified too for the incoming messages while the background service is inserting the messages into sqlite database.
How to implements such structure with sticky service. Is partial wake lock also needed. Since, images are also to be downloaded using http partially sometimes on specific demand.
You can start the service after registration on the server.
onStartCommand of service login the user.
Implement service with PacketListener,ConnectionListener,InvitationListener
PacketListener for Receiving Groupcaht or One to One chat messages.
ConnectionListener to check if connection to the server is connected or disconnected.
InvitationListener For getting Group invitations.
After successful login add these listeners.
Now when the message is received save that message in local database and send a Broadcast for the activities who want the message to be received.
Check if the app is in the background if yes then send the notification for the new message
Mail me if any buddy face any issue cvofjaspreet#gmail.com
I would like to create a instant message application. The problem I faced is that how can I know other has sent a message to me and my mobile can get a notification from server?
Developing Client side Application is must to notify the Update from server,
Have to run the back ground services continuously to find the update.
If you are accessing the android inbox message , no need to create the own service , we can use the android service here