setChannelId for Android 8 and above

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-12-29 15:57:33 +01:00 committed by Jonas Mayer
parent 2fc33a6eba
commit 30d03d84bc

View file

@ -26,6 +26,7 @@ import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.graphics.BitmapFactory
import android.os.Build
import androidx.core.app.NotificationCompat
import com.owncloud.android.R
import com.owncloud.android.lib.common.operations.RemoteOperationResult
@ -56,8 +57,11 @@ class UploadNotificationManager(private val context: Context, private val viewTh
setContentText(context.getString(R.string.worker_upload))
setSmallIcon(R.drawable.notification_icon)
setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.notification_icon))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD)
}
}
notification = notificationBuilder.build()
}
@ -83,7 +87,9 @@ class UploadNotificationManager(private val context: Context, private val viewTh
context.getString(R.string.common_cancel),
pendingIntent
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD)
}
setContentIntent(startIntent)
}