Skip to content

Commit 080bcb0

Browse files
committed
Merge branch 'feature/microphone_default'
2 parents b6ec846 + 2eb7756 commit 080bcb0

File tree

22 files changed

+1012
-920
lines changed

22 files changed

+1012
-920
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Podfile.lock
1717

1818
gradlew
1919
gradlew.bat
20-
21-
.build/
20+
.build/
21+
**/.cxx/

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.2.0
2+
3+
* Breaking change: AUDIO_SESSION_MICROPHONE=0 by default on iOS.
4+
* Migrate to Kotlin.
5+
* Bump min flutter version to 3.27.0, AGP to 8.5.2.
6+
17
## 0.1.25
28

39
* Fix SwiftPM support on macOS.

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,14 @@ All numeric values encoded in `AndroidAudioAttributes.toJson()` correspond exact
149149

150150
## iOS setup
151151

152-
This plugin contains APIs for accessing all of your phone's audio hardware.
153-
154-
When submitting your app to the app store, it will detect that this plugin contains microphone-related APIs and will require you to add an `NSMicrophoneUsageDescription` key to your `Info.plist` file explaining why your app needs microphone access.
155-
156-
If your app does indeed use the microphone, you can add this key to your `Info.plist` as follows:
152+
If you wish to use any of the APIs that access the microphone (`getRecordPermission`, `requestRecordPermission`), add this key to your `Info.plist`:
157153

158154
```xml
159155
<key>NSMicrophoneUsageDescription</key>
160156
<string>... explain why the app uses the microphone here ...</string>
161157
```
162158

163-
But if your app doesn't use the microphone, you can pass a build option to this plugin to "compile out" microphone code so that the app store won't ask for the above usage description. This can be done with either CocoaPods or SwiftPM builds.
159+
Next, pass a build option to this plugin to enable the microphone code in your build. This can be done with either CocoaPods or SwiftPM builds.
164160

165161
### CocoaPods
166162

@@ -175,7 +171,7 @@ post_install do |installer|
175171
target.build_configurations.each do |config|
176172
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
177173
'$(inherited)',
178-
'AUDIO_SESSION_MICROPHONE=0'
174+
'AUDIO_SESSION_MICROPHONE=1'
179175
]
180176
end
181177

@@ -191,10 +187,10 @@ Run `flutter clean` to force SwiftPM to pick up your new settings:
191187
flutter clean
192188
```
193189

194-
Export the environment variable `AUDIO_SESSION_MICROPHONE=0` before running your build command. E.g. Using the bash command line:
190+
Export the environment variable `AUDIO_SESSION_MICROPHONE=1` before running your build command. E.g. Using the bash command line:
195191

196192
```
197-
AUDIO_SESSION_MICROPHONE=0 flutter run
193+
AUDIO_SESSION_MICROPHONE=1 flutter run
198194
```
199195

200196
Note: `flutter clean` is needed whenever the value of `AUDIO_SESSION_MICROPHONE` changes, or whenever you switch between different projects that use audio_session with different `AUDIO_SESSION_MICROPHONE` values.

android/build.gradle

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ version "1.0"
33
def args = ["-Xlint:deprecation","-Xlint:unchecked"]
44

55
buildscript {
6+
ext {
7+
kotlin_version = '2.1.10'
8+
agp_version = '8.5.2'
9+
}
610
repositories {
711
google()
812
mavenCentral()
913
}
1014

1115
dependencies {
12-
classpath("com.android.tools.build:gradle:8.1.0")
16+
classpath("com.android.tools.build:gradle:$agp_version")
17+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1318
}
1419
}
1520

@@ -25,17 +30,20 @@ project.getTasks().withType(JavaCompile) {
2530
}
2631

2732
apply plugin: "com.android.library"
33+
apply plugin: "kotlin-android"
2834

2935
android {
30-
if (project.android.hasProperty("namespace")) {
31-
namespace = "com.ryanheise.audio_session"
32-
}
36+
namespace = "com.ryanheise.audio_session"
3337

34-
compileSdk = 34
38+
compileSdk = 35
3539

3640
compileOptions {
37-
sourceCompatibility = JavaVersion.VERSION_1_8
38-
targetCompatibility = JavaVersion.VERSION_1_8
41+
sourceCompatibility = JavaVersion.VERSION_11
42+
targetCompatibility = JavaVersion.VERSION_11
43+
}
44+
45+
kotlinOptions {
46+
jvmTarget = '11'
3947
}
4048

4149
defaultConfig {
@@ -51,4 +59,5 @@ android {
5159

5260
dependencies {
5361
implementation "androidx.media:media:1.7.0"
62+
implementation 'androidx.core:core-ktx:1.13.1'
5463
}
-9.94 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

0 commit comments

Comments
 (0)