Skip to content

Update permission_handler_android dependencies #1447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 47 additions & 42 deletions permission_handler_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,152 +1,157 @@
## 12.1.0

- Updates the package to correctly support Flutter 3.29.
- Migrates away from deprecated imperative Gradle plugins.

## 12.0.13

* Updates the Android min SDK to 19 (from 16).
* Migrates example app away from deprecated imperative apply in gradle (see: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply).
- Updates the Android min SDK to 19 (from 16).
- Migrates example app away from deprecated imperative apply in gradle (see: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply).

## 12.0.12

* Fixes permission status returned from `Permission.photos.request()` or `Permission.videos.request()` when limited access selected
- Fixes permission status returned from `Permission.photos.request()` or `Permission.videos.request()` when limited access selected

## 12.0.11

* Adds `TargetApi` annotation to `getManifestNames` method in `PermissionUtils.java`.
- Adds `TargetApi` annotation to `getManifestNames` method in `PermissionUtils.java`.

## 12.0.10

* Fixes a bug that causes a `NullPointerException` when the application is restarted after being killed by Android during the request of special permissions (like, `Permission.ignoreBatteryOptimizations`, `Permission.systemAlertWindow`, `Permission.accessNotificationPolicy`, `Permission.scheduleExactAlarm` and `Permission.manageExternalStorage`).
- Fixes a bug that causes a `NullPointerException` when the application is restarted after being killed by Android during the request of special permissions (like, `Permission.ignoreBatteryOptimizations`, `Permission.systemAlertWindow`, `Permission.accessNotificationPolicy`, `Permission.scheduleExactAlarm` and `Permission.manageExternalStorage`).

## 12.0.9

* Makes the status returned when requesting the READ_MEDIA_VISUAL_USER_SELECTED permission more accurate.
- Makes the status returned when requesting the READ_MEDIA_VISUAL_USER_SELECTED permission more accurate.

## 12.0.8

* Adds support for limited photo and video permission on Android.
- Adds support for limited photo and video permission on Android.

## 12.0.7

* Removes additional Android v1 embedding class reference.
- Removes additional Android v1 embedding class reference.

## 12.0.6

* Removes deprecated support for Android V1 embedding as support will be removed from Flutter (see [flutter/flutter#144726](https://github.com/flutter/flutter/pull/144726)).
- Removes deprecated support for Android V1 embedding as support will be removed from Flutter (see [flutter/flutter#144726](https://github.com/flutter/flutter/pull/144726)).

## 12.0.5

* Upgrades Gradle and Android Gradle plugin.
- Upgrades Gradle and Android Gradle plugin.

## 12.0.4

* Returns `granted` on permission `Permission.scheduleExactAlarm` for devices running lower than Android S (API 31), before this change the default return was `denied`.
* Updates `minSdkVersion` version to `flutter.minSdkVersion`.
- Returns `granted` on permission `Permission.scheduleExactAlarm` for devices running lower than Android S (API 31), before this change the default return was `denied`.
- Updates `minSdkVersion` version to `flutter.minSdkVersion`.

## 12.0.3

* Updates the dependency on `permission_handler_platform_interface` to version 4.1.0 (SiriKit support is only available for iOS or macOS).
- Updates the dependency on `permission_handler_platform_interface` to version 4.1.0 (SiriKit support is only available for iOS or macOS).

## 12.0.2

* Fixes bug where Android activity is leaked when embedded in native Android application.
- Fixes bug where Android activity is leaked when embedded in native Android application.

## 12.0.1

* Fixes a bug where the `ignoreBatteryOptimizations` permission didn't report the correct status when the permission is requested and granted.
- Fixes a bug where the `ignoreBatteryOptimizations` permission didn't report the correct status when the permission is requested and granted.

## 12.0.0

* **BREAKING CHANGES:**
* Adds `Permission.calendarWriteOnly`.
* Removes `Permission.calendarReadOnly`.
- **BREAKING CHANGES:**
- Adds `Permission.calendarWriteOnly`.
- Removes `Permission.calendarReadOnly`.

## 11.1.0

* Implements the `Permission.calendarReadOnly` and `PermissionCalendarFullAccess` permissions.
- Implements the `Permission.calendarReadOnly` and `PermissionCalendarFullAccess` permissions.

## 11.0.5

* Removes the obsolete `updatePermissionShouldShowStatus` method from the Java code base.
* Fixes some analysis warnings in the Java code base.
- Removes the obsolete `updatePermissionShouldShowStatus` method from the Java code base.
- Fixes some analysis warnings in the Java code base.

## 11.0.4

* Fixes a bug where the status of special permissions would incorrectly be reported as `denied`.
- Fixes a bug where the status of special permissions would incorrectly be reported as `denied`.

## 11.0.3

* Fixes a bug where `Permission.notification.status` would never return `permanentlyDenied` on Android.
- Fixes a bug where `Permission.notification.status` would never return `permanentlyDenied` on Android.

## 11.0.2

* Fixes a bug where `Permission.Phone` would always return 'denied' when requesting the permission status.
* Fixes a bug where Flutter permissions that require multiple Android permissions would base their status on the status of the first Android permission, as opposed to the result of all relevant Android permissions.
- Fixes a bug where `Permission.Phone` would always return 'denied' when requesting the permission status.
- Fixes a bug where Flutter permissions that require multiple Android permissions would base their status on the status of the first Android permission, as opposed to the result of all relevant Android permissions.

## 11.0.1

* Fixes `java.lang.IllegalStateException: Reply already submitted` when requesting post notification permission.
- Fixes `java.lang.IllegalStateException: Reply already submitted` when requesting post notification permission.

## 11.0.0

* **BREAKING CHANGE:** Fixes a bug where the permission status would return 'denied' regardless of whether the status was 'denied' or 'permanently denied'.
- **BREAKING CHANGE:** Fixes a bug where the permission status would return 'denied' regardless of whether the status was 'denied' or 'permanently denied'.

## 10.3.6

* Fixes a bug where requesting multiple permissions would crash the app if at least one of the permissions was a [special permission](https://developer.android.com/guide/topics/permissions/overview#special).
- Fixes a bug where requesting multiple permissions would crash the app if at least one of the permissions was a [special permission](https://developer.android.com/guide/topics/permissions/overview#special).

## 10.3.5

* Fixes a bug where `Permission.ScheduleExactAlarm` was not opening the settings
- Fixes a bug where `Permission.ScheduleExactAlarm` was not opening the settings
screen.

## 10.3.4

* Fixes a bug where the permission status would return 'permanently denied'
- Fixes a bug where the permission status would return 'permanently denied'
instead of 'denied' when the user dismisses the permission dialog.

## 10.3.3

* Migrates the Gradle compile arguments to the example app, so they are not enforced upon consumers of the plugin.
- Migrates the Gradle compile arguments to the example app, so they are not enforced upon consumers of the plugin.

## 10.3.2

* Updates example app to show `Permission.photos` and hide `Permission.bluetooth`.
- Updates example app to show `Permission.photos` and hide `Permission.bluetooth`.

## 10.3.1

* Fixes `java.lang.IllegalStateException: Reply already submitted` when checking the status of Bluetooth service.
- Fixes `java.lang.IllegalStateException: Reply already submitted` when checking the status of Bluetooth service.

## 10.3.0

* Adds support for the new Android 13 permission: BODY_SENSORS_BACKGROUND.
- Adds support for the new Android 13 permission: BODY_SENSORS_BACKGROUND.

## 10.2.3

* Fix missing POST_NOTIFICATIONS permission in the Android example project.
- Fix missing POST_NOTIFICATIONS permission in the Android example project.

## 10.2.2

* Fixes the SCHEDULE_EXACT_ALARM status check on Android 12 and 13.
- Fixes the SCHEDULE_EXACT_ALARM status check on Android 12 and 13.

## 10.2.1

* Adds compatibility with Android Gradle Plugin 8.0.
- Adds compatibility with Android Gradle Plugin 8.0.

## 10.2.0

* Adds support for the new Android 13 permissions: SCHEDULE_EXACT_ALARM, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO
- Adds support for the new Android 13 permissions: SCHEDULE_EXACT_ALARM, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO

## 10.1.0

* Adds support for the new Android 13 permission: NEARBY_WIFI_DEVICES.
- Adds support for the new Android 13 permission: NEARBY_WIFI_DEVICES.

## 10.0.0

* **BREAKING CHANGE**: Updates Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission.
- **BREAKING CHANGE**: Updates Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission.
> When updating to version 10.0.0 make sure to update the `android/app/build.gradle` file and set the `compileSdkVersion` to `33`.

## 9.0.2+1

* Undoes PR [#765](https://github.com/baseflow/flutter-permission-handler/pull/765) which by mistake requests write_external_storage permission based on the target SDK instead of the actual SDK of the Android device.
- Undoes PR [#765](https://github.com/baseflow/flutter-permission-handler/pull/765) which by mistake requests write_external_storage permission based on the target SDK instead of the actual SDK of the Android device.

## 9.0.2

* Moves Android implementation into its own package.
- Moves Android implementation into its own package.
5 changes: 4 additions & 1 deletion permission_handler_android/example/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
.cxx/

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
Original file line number Diff line number Diff line change
Expand Up @@ -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-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
2 changes: 1 addition & 1 deletion permission_handler_android/example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "com.android.application" version "8.7.0" apply false
}

include ":app"
100 changes: 55 additions & 45 deletions permission_handler_android/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,37 @@ import 'package:flutter/material.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';

void main() {
runApp(BaseflowPluginExample(
runApp(
BaseflowPluginExample(
pluginName: 'Permission Handler',
githubURL: 'https://github.com/Baseflow/flutter-permission-handler',
pubDevURL: 'https://pub.dev/packages/permission_handler',
pages: [PermissionHandlerWidget.createPage()]));
pages: [PermissionHandlerWidget.createPage()],
),
);
}

///Defines the main theme color
final MaterialColor themeMaterialColor =
BaseflowPluginExample.createMaterialColor(
const Color.fromRGBO(48, 49, 60, 1));
const Color.fromRGBO(48, 49, 60, 1),
);

/// A Flutter application demonstrating the functionality of this plugin
class PermissionHandlerWidget extends StatefulWidget {
/// Creates a [PermissionHandlerWidget].
const PermissionHandlerWidget({
super.key,
});
const PermissionHandlerWidget({super.key});

/// Create a page containing the functionality of this plugin
static ExamplePage createPage() {
return ExamplePage(
Icons.location_on, (context) => const PermissionHandlerWidget());
Icons.location_on,
(context) => const PermissionHandlerWidget(),
);
}

@override
_PermissionHandlerWidgetState createState() =>
State<PermissionHandlerWidget> createState() =>
_PermissionHandlerWidgetState();
}

Expand All @@ -38,36 +42,35 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
Widget build(BuildContext context) {
return Center(
child: ListView(
children: Permission.values
.where((permission) {
return permission != Permission.unknown &&
permission != Permission.mediaLibrary &&
permission != Permission.photosAddOnly &&
permission != Permission.reminders &&
permission != Permission.bluetooth &&
permission != Permission.appTrackingTransparency &&
permission != Permission.criticalAlerts &&
permission != Permission.assistant &&
permission != Permission.backgroundRefresh;
})
.map((permission) => PermissionWidget(permission))
.toList()),
children:
Permission.values
.where((permission) {
return permission != Permission.unknown &&
permission != Permission.mediaLibrary &&
permission != Permission.photosAddOnly &&
permission != Permission.reminders &&
permission != Permission.bluetooth &&
permission != Permission.appTrackingTransparency &&
permission != Permission.criticalAlerts &&
permission != Permission.assistant &&
permission != Permission.backgroundRefresh;
})
.map((permission) => PermissionWidget(permission))
.toList(),
),
);
}
}

/// Permission widget containing information about the passed [Permission]
class PermissionWidget extends StatefulWidget {
/// Constructs a [PermissionWidget] for the supplied [Permission]
const PermissionWidget(
this._permission, {
super.key,
});
const PermissionWidget(this._permission, {super.key});

final Permission _permission;

@override
_PermissionState createState() => _PermissionState();
State<PermissionWidget> createState() => _PermissionState();
}

class _PermissionState extends State<PermissionWidget> {
Expand All @@ -85,8 +88,9 @@ class _PermissionState extends State<PermissionWidget> {
}

void _listenForPermissionStatus() async {
final status =
await _permissionHandler.checkPermissionStatus(widget._permission);
final status = await _permissionHandler.checkPermissionStatus(
widget._permission,
);
setState(() => _permissionStatus = status);
}

Expand Down Expand Up @@ -114,29 +118,35 @@ class _PermissionState extends State<PermissionWidget> {
_permissionStatus.toString(),
style: TextStyle(color: getPermissionColor()),
),
trailing: (widget._permission is PermissionWithService)
? IconButton(
icon: const Icon(
Icons.info,
color: Colors.white,
),
onPressed: () {
checkServiceStatus(
context, widget._permission as PermissionWithService);
})
: null,
trailing:
(widget._permission is PermissionWithService)
? IconButton(
icon: const Icon(Icons.info, color: Colors.white),
onPressed: () {
checkServiceStatus(
context,
widget._permission as PermissionWithService,
);
},
)
: null,
onTap: () {
requestPermission(widget._permission);
},
);
}

void checkServiceStatus(
BuildContext context, PermissionWithService permission) async {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
(await _permissionHandler.checkServiceStatus(permission)).toString()),
));
BuildContext context,
PermissionWithService permission,
) async {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
(await _permissionHandler.checkServiceStatus(permission)).toString(),
),
),
);
}

Future<void> requestPermission(Permission permission) async {
Expand Down
Loading