Skip to content

Commit ad32fae

Browse files
authored
feat(sensors_plus)!: Change Android compile SDK, update Android build config (#3670)
1 parent 24363e2 commit ad32fae

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

packages/sensors_plus/sensors_plus/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[<img src="../../../assets/flutter-favorite-badge.png" width="100" />](https://flutter.dev/docs/development/packages-and-plugins/favorites)
88

9-
A Flutter plugin to access the accelerometer, gyroscope, magnetometer and
9+
A Flutter plugin to access the accelerometer, gyroscope, magnetometer and
1010
barometer sensors.
1111

1212
## Platform Support
@@ -23,15 +23,15 @@ barometer sensors.
2323
- Dart >=3.3.0 <4.0.0
2424
- iOS >=12.0
2525
- macOS >=10.14
26-
- Android `compileSDK` 34
2726
- Java 17
28-
- Android Gradle Plugin >=8.3.0
29-
- Gradle wrapper >=8.4
27+
- Kotlin 2.2.0
28+
- Android Gradle Plugin >=8.12.1
29+
- Gradle wrapper >=8.13
3030

3131
## Usage
3232

3333
Add `sensors_plus` as a dependency in your pubspec.yaml file.
34-
34+
3535
On iOS you must also include a key called [`NSMotionUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsmotionusagedescription) in your app's `Info.plist` file. This key provides a message that tells the user why the app is requesting access to the device’s motion data. The plugin itself needs access to motion data to get barometer data.
3636

3737
Example Info.plist entry:
@@ -67,7 +67,7 @@ The plugin exposes such classes of sensor events through a set of streams:
6767
- `GyroscopeEvent` describes the rotation of the device.
6868
- `MagnetometerEvent` describes the ambient magnetic field surrounding the
6969
device. A compass is an example usage of this data.
70-
- `BarometerEvent` describes the atmospheric pressure surrounding the device, in hPa.
70+
- `BarometerEvent` describes the atmospheric pressure surrounding the device, in hPa.
7171
An altimeter is an example usage of this data. Not supported on web browsers.
7272

7373
These events are exposed through a `BroadcastStream`: `accelerometerEvents`,
@@ -173,27 +173,27 @@ sensor data.
173173

174174
### Platform Restrictions and Considerations
175175

176-
The following lists the restrictions for the sensors on certain platforms due to limitations of the platform.
176+
The following lists the restrictions for the sensors on certain platforms due to limitations of the platform.
177177

178178
- **Magnetometer and Barometer missing for web**
179179

180-
The Magnetometer API is currently not supported by any modern web browsers. Check browser compatibility matrix on [MDN docs for Magnetormeter API](https://developer.mozilla.org/en-US/docs/Web/API/Magnetometer).
180+
The Magnetometer API is currently not supported by any modern web browsers. Check browser compatibility matrix on [MDN docs for Magnetormeter API](https://developer.mozilla.org/en-US/docs/Web/API/Magnetometer).
181181

182-
The Barometer API does not exist for web platforms as can be seen at [MDN docs forn Sensors API](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs).
182+
The Barometer API does not exist for web platforms as can be seen at [MDN docs forn Sensors API](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs).
183183

184-
Developers should consider alternative methods or inform users about the limitation when their application runs on a web platform.
184+
Developers should consider alternative methods or inform users about the limitation when their application runs on a web platform.
185185

186186
> [!NOTE]
187187
>
188188
> Plugin won't crash the app in the case of usage on these platforms, but it is highly recommended to add onError() to handle such cases gracefully.
189189
190190
- **Sampling periods for web**
191191

192-
Currently it is not possible to set sensors sampling rate on web. Calls to event streams at specied sampling periods will have the sampling period ignored.
192+
Currently it is not possible to set sensors sampling rate on web. Calls to event streams at specied sampling periods will have the sampling period ignored.
193193

194194
- **Barometer sampling period limitation for iOS**
195195

196-
On iOS devices, barometer updates are [CMAltimeter](https://developer.apple.com/documentation/coremotion/cmaltimeter) which provides updates at regular intervals that cannot be controlled by the user. Calls to `barometerEventStream` at specied sampling periods will have the sampling period ignored.
196+
On iOS devices, barometer updates are [CMAltimeter](https://developer.apple.com/documentation/coremotion/cmaltimeter) which provides updates at regular intervals that cannot be controlled by the user. Calls to `barometerEventStream` at specied sampling periods will have the sampling period ignored.
197197

198198
## Learn more
199199

packages/sensors_plus/sensors_plus/android/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ group 'dev.fluttercommunity.plus.sensors'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.7.22'
5+
ext.kotlin_version = '2.2.0'
66
repositories {
77
google()
88
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:8.3.1'
12+
classpath 'com.android.tools.build:gradle:8.12.1'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}
@@ -25,9 +25,8 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdk 34
29-
3028
namespace 'dev.fluttercommunity.plus.sensors'
29+
compileSdk = flutter.compileSdkVersion
3130

3231
compileOptions {
3332
sourceCompatibility JavaVersion.VERSION_17

packages/sensors_plus/sensors_plus/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/sensors_plus/sensors_plus/example/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (flutterVersionName == null) {
2222
}
2323

2424
android {
25-
compileSdk 34
25+
compileSdk = flutter.compileSdkVersion
2626

2727
namespace 'io.flutter.plugins.sensorsexample'
2828

@@ -41,8 +41,8 @@ android {
4141

4242
defaultConfig {
4343
applicationId "io.flutter.plugins.sensorsexample"
44-
minSdk 21
45-
targetSdk 34
44+
minSdk flutter.minSdkVersion
45+
targetSdk flutter.targetSdkVersion
4646
versionCode flutterVersionCode.toInteger()
4747
versionName flutterVersionName
4848
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
33
distributionPath=wrapper/dists
44
zipStorePath=wrapper/dists
55
zipStoreBase=GRADLE_USER_HOME

packages/sensors_plus/sensors_plus/example/android/settings.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "8.3.1" apply false
21+
id "com.android.application" version "8.12.1" apply false
22+
id "org.jetbrains.kotlin.android" version "2.2.0" apply false
2223
}
2324

2425
include ":app"

0 commit comments

Comments
 (0)