From 433373328b13faa6a150bb15ec46f4f9f7b63392 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 23 Apr 2021 16:41:05 +0200 Subject: [PATCH] Fixed Core Service notification icon --- app/src/main/AndroidManifest.xml | 2 +- .../org/linphone/service/CoreService.java | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/org/linphone/service/CoreService.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 807bd1582..0948ed057 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -216,7 +216,7 @@ android:label="@string/service_name" /> diff --git a/app/src/main/java/org/linphone/service/CoreService.java b/app/src/main/java/org/linphone/service/CoreService.java new file mode 100644 index 000000000..96f4ecc2b --- /dev/null +++ b/app/src/main/java/org/linphone/service/CoreService.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2010-2021 Belledonne Communications SARL. + * + * This file is part of linphone-android + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.linphone.service; + +import android.app.Notification; +import androidx.core.app.NotificationCompat; +import org.linphone.R; + +public class CoreService extends org.linphone.core.tools.service.CoreService { + @Override + public void createServiceNotification() { + mServiceNotification = + new NotificationCompat.Builder(this, SERVICE_NOTIFICATION_CHANNEL_ID) + .setContentTitle(SERVICE_NOTIFICATION_TITLE) + .setContentText(SERVICE_NOTIFICATION_CONTENT) + .setSmallIcon(getApplicationInfo().icon) + .setAutoCancel(false) + .setCategory(Notification.CATEGORY_SERVICE) + .setVisibility(NotificationCompat.VISIBILITY_SECRET) + .setWhen(System.currentTimeMillis()) + .setShowWhen(true) + .setOngoing(true) + .setSmallIcon(R.drawable.linphone_notification_icon) + .build(); + } +}