diff --git a/android/build.gradle b/android/build.gradle index 3bf34e5a..a0b6ffd7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 31 + compileSdk 34 if (project.android.hasProperty("namespace")) { namespace 'com.github.florent37.assets_audio_player' diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 6d0901d8..eeba63f3 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Nov 04 15:39:06 CET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 65d20148..71e9f79a 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ package="com.github.florent37.assets_audio_player"> + diff --git a/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt b/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt index 3d67d196..22719213 100644 --- a/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt +++ b/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt @@ -13,7 +13,6 @@ import android.os.Build import android.os.IBinder import android.support.v4.media.MediaMetadataCompat import android.support.v4.media.session.PlaybackStateCompat -import android.support.v4.media.session.PlaybackStateCompat.ACTION_SEEK_TO import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.media.session.MediaButtonReceiver @@ -24,6 +23,7 @@ import kotlinx.coroutines.launch import kotlin.math.abs import android.app.PendingIntent.FLAG_UPDATE_CURRENT import android.app.PendingIntent.FLAG_IMMUTABLE +import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK import android.support.v4.media.session.MediaSessionCompat import androidx.annotation.RequiresApi import com.github.florent37.assets_audio_player.AssetsAudioPlayerPlugin @@ -346,7 +346,12 @@ class NotificationService : Service() { } .setShowWhen(false) .build() - startForeground(NOTIFICATION_ID, notification) + + if (Build.VERSION.SDK_INT >= 29) { + startForeground(NOTIFICATION_ID, notification, FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK) + } else { + startForeground(NOTIFICATION_ID, notification) + } //fix for https://github.com/florent37/Flutter-AssetsAudioPlayer/issues/139 if (!action.isPlaying && Build.VERSION.SDK_INT >= 24) { diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 2fb5dbaa..624d4815 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,11 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 32 + if (project.android.hasProperty("namespace")) { + namespace 'com.github.florent37.example' + } + + compileSdk 34 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -39,8 +43,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.github.florent37.example" - minSdkVersion 19 - targetSdkVersion 32 + minSdk 19 + targetSdk 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -63,5 +67,5 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/example/android/build.gradle b/example/android/build.gradle index 11c7f341..954fa1cd 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.21' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.2' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 595fb867..e6b38c2d 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/pubspec.yaml b/pubspec.yaml index 9de0400b..bcac11ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 # assets_audio_player_web: ^3.0.0-nullsafety.0 - assets_audio_player_web: ^3.0.6 + assets_audio_player_web: ^3.1.1 dev_dependencies: flutter_test: