Skip to content

Commit b155dbc

Browse files
committed
V2.5.7
* Fix build Android * Fix stop sound notification when screen off Android
1 parent ef0ddc6 commit b155dbc

File tree

4 files changed

+27
-17
lines changed

4 files changed

+27
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.5.7
2+
* Fix build Android
3+
* Fix stop sound notification when screen off Android
4+
15
## 2.5.6
26
* Fix bug duplicate permission Android
37
* Replaces MediaPlayer with Ringtone Android

android/build.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ apply plugin: 'com.android.library'
2828
apply plugin: 'kotlin-android'
2929

3030
android {
31-
compileSdk 34
31+
compileSdk 35
3232

3333
if (project.android.hasProperty("namespace")) {
3434
namespace "com.hiennv.flutter_callkit_incoming"
@@ -39,10 +39,19 @@ android {
3939
}
4040
defaultConfig {
4141
minSdk 16
42-
targetSdk 34
42+
targetSdk 35
4343

4444
consumerProguardFiles 'consumer-rules.pro'
4545
}
46+
47+
compileOptions {
48+
sourceCompatibility JavaVersion.VERSION_17
49+
targetCompatibility JavaVersion.VERSION_17
50+
}
51+
52+
kotlinOptions {
53+
jvmTarget = "17"
54+
}
4655
}
4756

4857
java {
@@ -51,10 +60,6 @@ java {
5160
}
5261
}
5362

54-
kotlin {
55-
jvmToolchain(17)
56-
}
57-
5863
dependencies {
5964
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
6065
implementation 'androidx.core:core-ktx:1.13.1'

android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitSoundPlayerManager.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,38 @@ class CallkitSoundPlayerManager(private val context: Context) {
3333
private var screenOffCallkitIncomingBroadcastReceiver = ScreenOffCallkitIncomingBroadcastReceiver()
3434

3535

36-
init {
37-
val filter = IntentFilter(Intent.ACTION_SCREEN_OFF)
38-
context.registerReceiver(screenOffCallkitIncomingBroadcastReceiver, filter)
39-
}
40-
41-
4236
fun play(data: Bundle) {
37+
this.isPlaying = true
4338
this.prepare()
4439
this.playSound(data)
4540
this.playVibrator()
46-
this.isPlaying = true
41+
42+
val filter = IntentFilter(Intent.ACTION_SCREEN_OFF)
43+
context.registerReceiver(screenOffCallkitIncomingBroadcastReceiver, filter)
4744
}
4845

4946
fun stop() {
5047
this.isPlaying = false
48+
5149
ringtone?.stop()
5250
vibrator?.cancel()
53-
5451
ringtone = null
5552
vibrator = null
53+
try {
54+
context.unregisterReceiver(screenOffCallkitIncomingBroadcastReceiver)
55+
}catch (_: Exception){}
5656
}
5757

5858
fun destroy() {
5959
this.isPlaying = false
60-
context.unregisterReceiver(screenOffCallkitIncomingBroadcastReceiver)
6160

6261
ringtone?.stop()
6362
vibrator?.cancel()
64-
6563
ringtone = null
6664
vibrator = null
65+
try {
66+
context.unregisterReceiver(screenOffCallkitIncomingBroadcastReceiver)
67+
}catch (_: Exception){}
6768
}
6869

6970
private fun prepare() {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_callkit_incoming
22
description: Flutter Callkit Incoming to show callkit screen in your Flutter app.
3-
version: 2.5.6
3+
version: 2.5.7
44
homepage: https://github.com/hiennguyen92/flutter_callkit_incoming
55
repository: https://github.com/hiennguyen92/flutter_callkit_incoming
66
issue_tracker: https://github.com/hiennguyen92/flutter_callkit_incoming/issues

0 commit comments

Comments
 (0)