room-15 / ChatSE

An Android application for StackOverflow and StackExchange chat! Revived by Tristan Wiley, base app created by Anubian
Apache License 2.0
22 stars 18 forks source link

Replace deprecated getRunningTasks with another solution #51

Open TristanWiley opened 6 years ago

TristanWiley commented 6 years ago

In IncomingEventService, getRunningTasks is deprecated. This is used to get the foregroundTaskInfo and determine if our app is in the foreground.

We need a non-deprecated way to do this.

TimCastelijns commented 5 years ago

As an alternative to using ActivityManager, it's possible to have the application class listen for activity lifecycle changes. Then you can derive that the app is in the background if Application.currentForegroundActivity = null or something. Not implying it's better, but now you have 2 options 🙂