How to run chat activity in background to show message notification,and also tell when chat activity is in foreground then it doesn't show any notification
Asked
Active
Viewed 855 times
3 Answers
0
When you want to do something in the background,you can use a AsyncTask. https://developer.android.com/reference/android/os/AsyncTask.html

Fluctus
- 1
- 2
0
You should user android NotificationManager for that purpose.
And chech this post Notification Click: Activity Already Open

Community
- 1
- 1

Emmanuel Mtali
- 4,383
- 3
- 27
- 53
0
Here is a fine piece of document containing sample code with notifications manager on Services
Also AsyncTask is not suited for long running operations as your async service will be killed off with your app where foreground service can live past that.

P.C. Blazkowicz
- 489
- 1
- 4
- 11