mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Only call start foreground once from FCM.
This commit is contained in:
@@ -48,8 +48,12 @@ object FcmFetchManager {
|
||||
try {
|
||||
if (foreground) {
|
||||
Log.i(TAG, "Starting in the foreground.")
|
||||
ForegroundServiceUtil.startWhenCapableOrThrow(context, Intent(context, FcmFetchForegroundService::class.java), MAX_BLOCKING_TIME_MS)
|
||||
startedForeground = true
|
||||
if (!startedForeground) {
|
||||
ForegroundServiceUtil.startWhenCapableOrThrow(context, Intent(context, FcmFetchForegroundService::class.java), MAX_BLOCKING_TIME_MS)
|
||||
startedForeground = true
|
||||
} else {
|
||||
Log.i(TAG, "Already started foreground service")
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "Starting in the background.")
|
||||
context.startService(Intent(context, FcmFetchBackgroundService::class.java))
|
||||
@@ -72,13 +76,6 @@ object FcmFetchManager {
|
||||
return true
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isForegroundStarted(): Boolean {
|
||||
synchronized(this) {
|
||||
return startedForeground
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetch(context: Context) {
|
||||
retrieveMessages(context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user