Improved error log in case it is 'expected'

This commit is contained in:
Sylvain Berfini 2023-05-22 09:41:23 +02:00
parent 666a4f1ad0
commit 41f6139137
2 changed files with 10 additions and 2 deletions

View file

@ -34,7 +34,8 @@ class CoreService : CoreService() {
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.i("[Service] Ensuring Core exists")
Log.i("[Service] Starting, ensuring Core exists")
if (corePreferences.keepServiceAlive) {
Log.i("[Service] Starting as foreground to keep app alive in background")
if (!ensureCoreExists(

View file

@ -320,7 +320,14 @@ class NotificationsManager(private val context: Context) {
try {
notificationManager.notify(tag, id, notification)
} catch (iae: IllegalArgumentException) {
Log.e("[Notifications Manager] Exception occurred: $iae")
if (service == null && tag == null) {
// We can't notify using CallStyle if there isn't a foreground service running
Log.w(
"[Notifications Manager] Foreground service hasn't started yet, can't display a CallStyle notification until then: $iae"
)
} else {
Log.e("[Notifications Manager] Exception occurred: $iae")
}
}
}