Hello,
I wrote an app that send a notification if the result of a query is not null.
How can I send this notification, even if the app is close and it isn't in the task manager?
If the app is not running, the is no code to be executed, therefore is impossible to show a notification.
BUT if you have a service, from the service you can fire a notification. A service is the normal place for a notification. For example in your phone you receive a notification when you receive an email when your email app is not running. There is a service which periodically check for new emails.
...which is a normal notification. A message at the top of the phone with an icon, a title and a message. Or something better if you use some specialized library.
You can find a lot of examples.
The Erel's examples I already mentioned in post #2 are very good.
You can also see the example I made for services and sockets in http://www.b4x.com/android/forum/threads/45017/#content which is extensively commented out, most of all from programmers coming from vb6
Why sticky?
I mean, a service is a service. It can be standard, or StartForeground or Sticky but at the end they are the same.
The differences are that a StartForeground services has an icon on the task bar (let's say is not invisible) and is good for services that performs long running operation (download a huge file for example). Sticky services are more persistent, normally the O.S. doesn't kill the sticky services and if it kills it, it will be recreated as soon as possible by the same o.s.