File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed
java/org/kiwix/kiwixmobile/core/downloader/downloadManager Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 9797 <service
9898 android : name =" .downloader.downloadManager.DownloadMonitorService"
9999 android : foregroundServiceType =" dataSync" />
100+ <receiver
101+ android : name =" .downloader.downloadManager.DownloadTimeoutDismissReceiver"
102+ android : exported =" false" />
100103 </application >
101104</manifest >
Original file line number Diff line number Diff line change @@ -183,10 +183,10 @@ class DownloadMonitorService : Service() {
183183 FLAG_IMMUTABLE or FLAG_UPDATE_CURRENT
184184 )
185185
186- val noIntent = Intent (this , javaClass ).apply {
186+ val noIntent = Intent (this , DownloadTimeoutDismissReceiver :: class .java ).apply {
187187 action = BACKGROUND_DOWNLOAD_LIMIT_REACH_ACTION
188188 }
189- val noPendingIntent = PendingIntent .getService (
189+ val noPendingIntent = PendingIntent .getBroadcast (
190190 this ,
191191 DOWNLOAD_TIMEOUT_NOTIFICATION_NO_REQUEST_CODE ,
192192 noIntent,
Original file line number Diff line number Diff line change 1+ /*
2+ * Kiwix Android
3+ * Copyright (c) 2025 Kiwix <android.kiwix.org>
4+ * This program is free software: you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation, either version 3 of the License, or
7+ * (at your option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ * GNU General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU General Public License
15+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
16+ *
17+ */
18+
19+ package org.kiwix.kiwixmobile.core.downloader.downloadManager
20+
21+ import android.app.NotificationManager
22+ import android.content.Context
23+ import android.content.Intent
24+ import org.kiwix.kiwixmobile.core.base.BaseBroadcastReceiver
25+
26+ class DownloadTimeoutDismissReceiver : BaseBroadcastReceiver () {
27+ override val action = BACKGROUND_DOWNLOAD_LIMIT_REACH_ACTION
28+ override fun onIntentWithActionReceived (
29+ context : Context ,
30+ intent : Intent
31+ ) {
32+ runCatching {
33+ val notificationManager =
34+ context.getSystemService(Context .NOTIFICATION_SERVICE ) as NotificationManager
35+ notificationManager.cancel(DOWNLOAD_TIMEOUT_LIMIT_REACH_NOTIFICATION_ID )
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments