How to show notification from background service?
android, notifications
Solution
Am I reading this incorrectly? Both your server app and your client app are both on the same Android device?
In any case, take a look at the ApiDemos for code for notifications through a service.
And since you're probably going to be dealing with a remote server (and not a local one) and all the latency issues associated with the network, I think you better wrap your service in an AsyncTask.
Also learn about Broadcast Receivers, registered Broadcast Receivers can be great way to trigger Services/Activities without the need to have your own Service polling in a loop indefinitely.
Problem
The project I am working on has two different apps, 1 is server and other is client. Server app has 1 service class, which initiates server thread in `onStartCommand()` function. Class for server thread is defined in service class itself. Whenever server receives any data from client it stores in the database. So problem is, I want to notify user that new data has been arrived through notification or toast message whichever possible. Also tell me where should I write code for notification, whether I should write in service class or thread class or `firstActivity` class from which i am starting server service. Thank you.