Skip to content

Commit

Permalink
Broadcast receiver fix (#1699)
Browse files Browse the repository at this point in the history
* Fixed broadcast receiver on android 14

* Update preview with texture view

* 🤖 Automated Format and Fix

* Updated screenshare receiver intent

* Merged develop

* 🤖 Automated Format and Fix

* Update changelog

* Updated comments

* released sample app version 1.5.130 (430) 🍀

* updated gems

* Added changelogs for 1.9.8 release

* 🤖 Automated Format and Fix

---------

Co-authored-by: Decoder07 <[email protected]>
Co-authored-by: Yogesh Singh <[email protected]>
  • Loading branch information
3 people authored Feb 1, 2024
1 parent d7d78fc commit 4c5f519
Show file tree
Hide file tree
Showing 23 changed files with 170 additions and 119 deletions.
9 changes: 9 additions & 0 deletions packages/hms_room_kit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
| hms_room_kit | [![Pub Version](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit) |
| hmssdk_flutter | [![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter) |

## 1.0.11 - 2024-02-01

| Package | Version |
| -------------- | ------------------------------------------------------------------------------------------------------ |
| hms_room_kit | 1.0.11 |
| hmssdk_flutter | 1.9.8 |

Updated `hmssdk_flutter` package version to 1.9.8

## 1.0.10 - 2024-01-18

| Package | Version |
Expand Down
7 changes: 3 additions & 4 deletions packages/hms_room_kit/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,9 @@ packages:
hmssdk_flutter:
dependency: transitive
description:
name: hmssdk_flutter
sha256: "78db3329609ca9f9a90168d45b9bed0ff56f43d1eeb13b532aa376de2aa44a4a"
url: "https://pub.dev"
source: hosted
path: "../../hmssdk_flutter"
relative: true
source: path
version: "1.9.7"
http:
dependency: transitive
Expand Down
2 changes: 1 addition & 1 deletion packages/hms_room_kit/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.10
version: 1.0.11

environment:
sdk: ">=2.19.6 <3.0.0"
Expand Down
7 changes: 3 additions & 4 deletions packages/hms_room_kit/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ packages:
hmssdk_flutter:
dependency: "direct main"
description:
name: hmssdk_flutter
sha256: "78db3329609ca9f9a90168d45b9bed0ff56f43d1eeb13b532aa376de2aa44a4a"
url: "https://pub.dev"
source: hosted
path: "../hmssdk_flutter"
relative: true
source: path
version: "1.9.7"
http:
dependency: transitive
Expand Down
5 changes: 3 additions & 2 deletions packages/hms_room_kit/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: hms_room_kit
description: 100ms Room Kit provides simple & easy to use UI components to build Live Streaming & Video Conferencing experiences in your apps.
version: 1.0.10
version: 1.0.11
homepage: https://www.100ms.live/
repository: https://github.com/100mslive/100ms-flutter
issue_tracker: https://github.com/100mslive/100ms-flutter/issues
Expand All @@ -14,7 +14,8 @@ dependencies:
flutter:
sdk: flutter

hmssdk_flutter: 1.9.7
hmssdk_flutter:
path: ../hmssdk_flutter
intl: ^0.18.0
permission_handler: ^11.0.0
provider: ^6.0.5
Expand Down
15 changes: 15 additions & 0 deletions packages/hmssdk_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
| hms_room_kit | [![Pub Version](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit) |
| hmssdk_flutter | [![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter) |

# 1.9.8 - 2024-02-01

| Package | Version |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| hms_room_kit | 1.0.11 |
| hmssdk_flutter | 1.9.8 |

### 🛠️ Changed

- Fixed broadcast receiver issues on android 14 devices

Learn more about this issue [here](https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported)

**Full Changelog**: [1.9.7...1.9.8](https://github.com/100mslive/100ms-flutter/compare/1.9.7...1.9.8)

# 1.9.7 - 2024-01-18

| Package | Version |
Expand Down
2 changes: 1 addition & 1 deletion packages/hmssdk_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package live.hms.hmssdk_flutter
import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Context.*
import android.content.Intent
import android.content.IntentFilter
import android.media.projection.MediaProjectionManager
Expand Down Expand Up @@ -1543,7 +1544,11 @@ class HmssdkFlutterPlugin :

private fun startScreenShare(result: Result) {
androidScreenshareResult = result
activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"), RECEIVER_EXPORTED)
}else {
activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"))
}
val mediaProjectionManager: MediaProjectionManager =
activity.getSystemService(
Context.MEDIA_PROJECTION_SERVICE,
Expand Down Expand Up @@ -1608,7 +1613,11 @@ class HmssdkFlutterPlugin :
) {
androidAudioShareResult = result
mode = call.argument<String>("audio_mixing_mode")
activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"), RECEIVER_EXPORTED)
}else {
activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"),)
}
val mediaProjectionManager: MediaProjectionManager? =
activity.getSystemService(
Context.MEDIA_PROJECTION_SERVICE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package live.hms.hmssdk_flutter.views

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Context.RECEIVER_NOT_EXPORTED
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.util.Log
import android.view.LayoutInflater
import android.widget.FrameLayout
Expand Down Expand Up @@ -116,7 +118,11 @@ class HMSHLSPlayer(
* onRoomUpdate or onJoin
*/
player.play(streamUrl)
context.registerReceiver(broadcastReceiver, IntentFilter(HLS_PLAYER_INTENT))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(broadcastReceiver, IntentFilter(HLS_PLAYER_INTENT), RECEIVER_NOT_EXPORTED)
}else {
context.registerReceiver(broadcastReceiver, IntentFilter(HLS_PLAYER_INTENT))
}

/**
* Here we add the event listener to listen to the events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ package live.hms.hmssdk_flutter.views

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Context.RECEIVER_EXPORTED
import android.content.Context.RECEIVER_NOT_EXPORTED
import android.content.Intent
import android.content.IntentFilter
import android.graphics.Bitmap
import android.os.Build
import android.util.Base64
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -106,7 +109,11 @@ class HMSVideoView(
if (hmsVideoView != null) {
// delay addTrack
hmsVideoView?.addTrack(track)
context.registerReceiver(broadcastReceiver, IntentFilter(track.trackId))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(broadcastReceiver, IntentFilter(track.trackId), RECEIVER_NOT_EXPORTED)
}else {
context.registerReceiver(broadcastReceiver, IntentFilter(track.trackId))
}
} else {
Log.e("HMSVideoView Error", "onAttachedToWindow error hmsVideoView is null")
}
Expand Down
18 changes: 6 additions & 12 deletions packages/hmssdk_flutter/example/ExampleAppChangelog.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
Board: https://100ms.atlassian.net/jira/software/projects/FLUT/boards/34/

- Prebuilt: Auto-Hide Top & Bottom Bars after 5 seconds
https://100ms.atlassian.net/browse/FLUT-139
- Resolve issues reported by VAPT testing
https://100ms.atlassian.net/browse/FLUT-218

- iOS: end session from dashboard not kicking iOS user intermittently
https://100ms.atlassian.net/browse/FLUT-201
- Resolve crash on Android 14 devices due to Broadcast Receiver in HMSVideoView
https://100ms.atlassian.net/browse/FLUT-219

- Wrong device list on top right when BT is connected
https://100ms.atlassian.net/browse/FLUT-215

- Hide BT and notificatin permission on Flutter Android for platform parity
https://100ms.atlassian.net/browse/FLUT-216

Room Kit: 1.0.10
Core SDK: 1.9.7
Room Kit: 1.0.11
Core SDK: 1.9.8
Android SDK: 2.8.8
iOS SDK: 1.4.2
54 changes: 28 additions & 26 deletions packages/hmssdk_flutter/example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.879.0)
aws-sdk-core (3.190.2)
aws-partitions (1.885.0)
aws-sdk-core (3.191.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.76.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sdk-kms (1.77.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.142.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-s3 (1.143.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand All @@ -34,7 +34,7 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
Expand Down Expand Up @@ -111,43 +111,46 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.7.4)
fastlane-plugin-firebase_app_distribution (0.8.1)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
google-apis-androidpublisher_v3 (0.55.0)
google-apis-core (>= 0.12.0, < 2.a)
google-apis-core (0.13.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.31.0)
google-apis-firebaseappdistribution_v1alpha (0.2.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.18.0)
google-apis-core (>= 0.12.0, < 2.a)
google-apis-playcustomapp_v1 (0.14.0)
google-apis-core (>= 0.12.0, < 2.a)
google-apis-storage_v1 (0.33.0)
google-apis-core (>= 0.12.0, < 2.a)
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.0)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-storage (1.47.0)
google-cloud-storage (1.48.1)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.31.0)
google-apis-core (~> 0.13)
google-apis-iamcredentials_v1 (~> 0.18)
google-apis-storage_v1 (~> 0.33)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
googleauth (~> 1.9)
mini_mime (~> 1.0)
googleauth (1.9.1)
googleauth (1.9.2)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
Expand All @@ -165,7 +168,7 @@ GEM
jwt (2.7.1)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.20.0)
minitest (5.21.2)
multi_json (1.15.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
Expand Down Expand Up @@ -205,9 +208,8 @@ GEM
concurrent-ruby (~> 1.0)
uber (0.1.0)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.23.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
8 changes: 4 additions & 4 deletions packages/hmssdk_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 33
compileSdkVersion 34
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
Expand All @@ -30,9 +30,9 @@ android {
defaultConfig {
applicationId "live.hms.flutter"
minSdkVersion 21
targetSdkVersion 33
versionCode 428
versionName "1.5.128"
targetSdkVersion 34
versionCode 430
versionName "1.5.130"
}

signingConfigs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<!--Required for android 14 and above -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

<!-- This is required if the application uses foreground service for android 14 and above-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />


<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
Expand Down
2 changes: 1 addition & 1 deletion packages/hmssdk_flutter/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.8'
classpath 'com.google.gms:google-services:4.3.15'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4c5f519

Please sign in to comment.