diff --git a/CHANGELOG.md b/CHANGELOG.md
index 320a0a34..3ec67710 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 4.3.2
+**Widget changes:**
+- Remove custom worker initializer to avoid forcing apps to remove the default one in the manifest or to avoid crashes when the app has its own custom initializer
+- Add foregroundServiceType to support Android 14 and newer
+
## 4.3.1
**Changes:**
* bugfix: UploadcareClient class visibility
diff --git a/README.md b/README.md
index ceb694b2..af826ffc 100644
--- a/README.md
+++ b/README.md
@@ -50,5 +50,5 @@ Supported features:
* Gradle 7.6
* JDK 11
-* Android SDK 34
+* Android SDK 22
diff --git a/documentation/WIDGET.md b/documentation/WIDGET.md
index ed5ab74e..606253e0 100644
--- a/documentation/WIDGET.md
+++ b/documentation/WIDGET.md
@@ -12,6 +12,17 @@
```
+#### If your app targets Android 14 (API level 34) or higher you must specify a foreground service type for all long-running workers.
+
+Declare your worker's foreground service type with `dataSync` foreground service type in your app's manifest to support our worker:
+
+```xml
+
+```
+
##### Select and upload file to Uploadcare from any available social network/camera/local file from Activity/Fragment.
Kotlin
diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml
index 982f8206..c727bb62 100644
--- a/example/src/main/AndroidManifest.xml
+++ b/example/src/main/AndroidManifest.xml
@@ -22,11 +22,6 @@
-
-
diff --git a/gradle.properties b/gradle.properties
index 1ae07acb..41e9de1f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,5 +1,5 @@
# Project-wide Gradle settings.
-version=4.3.1
+version=4.3.2
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 74079dec..64c0e7a2 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
[versions]
-appVersion = "4.3.1"
+appVersion = "4.3.2"
kotlinVersion = "2.0.10"
kotlinCoroutines = "1.8.1"
minSdk = "22"
diff --git a/library/README.md b/library/README.md
index 1ff3e6c4..7129907f 100644
--- a/library/README.md
+++ b/library/README.md
@@ -25,5 +25,5 @@ The latest stable version is available at Maven Central.
To include it in your Android project, add this line to the 'gradle.build' file:
```
-implementation 'com.uploadcare.android.library:uploadcare-android:4.3.1'
+implementation 'com.uploadcare.android.library:uploadcare-android:4.3.2'
```
diff --git a/widget/README.md b/widget/README.md
index 9d34668b..b459eebc 100644
--- a/widget/README.md
+++ b/widget/README.md
@@ -20,5 +20,5 @@ The latest stable version is available at Maven Central.
To include it in your Android project, add this line to the 'gradle.build' file:
```
-implementation 'com.uploadcare.android.widget:uploadcare-android-widget:4.3.1'
+implementation 'com.uploadcare.android.widget:uploadcare-android-widget:4.3.2'
```
diff --git a/widget/src/main/AndroidManifest.xml b/widget/src/main/AndroidManifest.xml
index 96142e84..509e4416 100644
--- a/widget/src/main/AndroidManifest.xml
+++ b/widget/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
+
-
-
+
+
diff --git a/widget/src/main/java/com/uploadcare/android/widget/worker/FileUploadWorker.kt b/widget/src/main/java/com/uploadcare/android/widget/worker/FileUploadWorker.kt
index f9a7f5bc..903780de 100644
--- a/widget/src/main/java/com/uploadcare/android/widget/worker/FileUploadWorker.kt
+++ b/widget/src/main/java/com/uploadcare/android/widget/worker/FileUploadWorker.kt
@@ -3,6 +3,7 @@ package com.uploadcare.android.widget.worker
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
+import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
@@ -99,7 +100,15 @@ class FileUploadWorker(appContext: Context,
private fun createForegroundInfo(notificationBuilder: NotificationCompat.Builder)
: ForegroundInfo {
//Notification ID
- return ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build())
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ ForegroundInfo(
+ NOTIFICATION_ID,
+ notificationBuilder.build(),
+ FOREGROUND_SERVICE_TYPE_DATA_SYNC
+ )
+ } else {
+ ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build())
+ }
}
private fun updateNotificationProgress(content: String, progress: Int) {
diff --git a/widget/src/main/java/com/uploadcare/android/widget/worker/UploadcareWorkManagerInitializer.kt b/widget/src/main/java/com/uploadcare/android/widget/worker/UploadcareWidgetInitializer.kt
similarity index 82%
rename from widget/src/main/java/com/uploadcare/android/widget/worker/UploadcareWorkManagerInitializer.kt
rename to widget/src/main/java/com/uploadcare/android/widget/worker/UploadcareWidgetInitializer.kt
index b651cf71..11b7a27d 100644
--- a/widget/src/main/java/com/uploadcare/android/widget/worker/UploadcareWorkManagerInitializer.kt
+++ b/widget/src/main/java/com/uploadcare/android/widget/worker/UploadcareWidgetInitializer.kt
@@ -7,8 +7,6 @@ import android.content.pm.ProviderInfo
import android.database.Cursor
import android.net.Uri
import androidx.annotation.RestrictTo
-import androidx.work.Configuration
-import androidx.work.WorkManager
import com.uploadcare.android.widget.controller.UploadcareWidget
/**
@@ -18,18 +16,11 @@ import com.uploadcare.android.widget.controller.UploadcareWidget
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-class UploadcareWorkManagerInitializer : ContentProvider() {
+class UploadcareWidgetInitializer : ContentProvider() {
override fun onCreate(): Boolean {
//Initialize UploadcareWidget.
UploadcareWidget.init(context!!)
- // provide custom configuration
- val workManagerConfig = Configuration.Builder()
- .setMinimumLoggingLevel(android.util.Log.INFO)
- .build()
-
- // initialize WorkManager
- WorkManager.initialize(context!!, workManagerConfig)
return true
}