Skip to content

Commit e21cc09

Browse files
committed
feat(example): support for Android 34
1 parent 4286017 commit e21cc09

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ runtime.
7474
The uploader comes with a notification to show the progress. So if your application targets Android
7575
33+, you might request `android.permission.POST_NOTIFICATIONS` permission at runtime.
7676

77+
When targeting Android API Level 34+, you must declare the service type in your application's manifest file.
78+
In your `AndroidManifest.xml` file, add the following lines in the `<application>` tag:
79+
80+
```xml
81+
<service
82+
android:name="androidx.work.impl.foreground.SystemForegroundService"
83+
android:foregroundServiceType="location|dataSync"
84+
tools:node="merge" />
85+
```
86+
7787
#### Notifications
7888

7989
To customize the notification to your own brand, you can change the icon, color or channel name by

android/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,18 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdkVersion 33
29-
3028
sourceSets {
3129
main.java.srcDirs += 'src/main/kotlin'
3230
}
3331
defaultConfig {
3432
minSdkVersion 21
33+
compileSdk 34
3534
}
3635
}
3736

3837
dependencies {
3938
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
40-
implementation 'video.api:android-video-uploader:1.3.2'
39+
implementation 'video.api:android-video-uploader:1.3.3'
4140
implementation 'androidx.work:work-runtime-ktx:2.8.1'
4241
implementation 'androidx.appcompat:appcompat:1.6.1'
4342
}

android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
android:maxSdkVersion="32" />
88
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
99
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
10+
11+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
1012
</manifest>

example/android/app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 33
30-
3129
sourceSets {
3230
main.java.srcDirs += 'src/main/kotlin'
3331
}
3432

3533
defaultConfig {
3634
applicationId "video.api.flutter.uploader.example"
37-
minSdkVersion 21
38-
targetSdkVersion 30
35+
36+
minSdk 21
37+
compileSdk 34
38+
targetSdk 34
39+
3940
versionCode flutterVersionCode.toInteger()
4041
versionName flutterVersionName
4142
}

example/android/app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
23
package="video.api.flutter.uploader.example">
3-
4+
45
<application
56
android:icon="@drawable/ic_api_video"
67
android:label="FltUploader">
78
<activity
89
android:name=".MainActivity"
910
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
11+
android:exported="true"
1012
android:hardwareAccelerated="true"
1113
android:launchMode="singleTop"
1214
android:theme="@style/LaunchTheme"
@@ -40,5 +42,11 @@
4042
<meta-data
4143
android:name="flutterEmbedding"
4244
android:value="2" />
45+
46+
<service
47+
android:name="androidx.work.impl.foreground.SystemForegroundService"
48+
android:foregroundServiceType="location|dataSync"
49+
tools:node="merge" />
4350
</application>
51+
4452
</manifest>

0 commit comments

Comments
 (0)