Skip to content

[Bug report] addChangeCallback is not working on Android 15 #1301

@Turtllor

Description

@Turtllor

Version

photo_manager: ^3.7.1

Platforms

Android

Device Model

Google Simulator Android 15,OPPO FIND X5 PRO Android 15

flutter info

[✓] Flutter (Channel stable, 3.27.0, on macOS 15.5 24F74 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.27.0 on channel stable at /Users/issuser/Library/SDK/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8495dee1fd (8 个月前), 2024-12-10 14:23:39 -0800
    • Engine revision 83bacfc525
    • Dart version 3.6.0
    • DevTools version 2.40.2
    • Pub download mirror https://mirrors.tuna.tsinghua.edu.cn/dart-pub
    • Flutter download mirror https://mirrors.tuna.tsinghua.edu.cn/flutter

[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    • Android SDK at /Users/issuser/Library/Android/sdk
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /Users/issuser/Library/Java/JavaVirtualMachines/ms-17.0.15/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Microsoft-11369864 (build 17.0.15+6-LTS)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] Connected device (7 available)
    • PFEM10 (mobile)                 • ce729257                             • android-arm64  • Android 15 (API 35)
    • sdk gphone64 arm64 (mobile)     • emulator-5554                        • android-arm64  • Android 15 (API 35) (emulator)
    • 测试机1225 (mobile)                • 00008140-00120C4E14EA801C            • ios            • iOS 18.3.1 22D72
    • iPhone 16 Pro (mobile)          • B69FC9F8-A34E-4385-A0F6-46B817734524 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-5 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 15.5 24F74 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 15.5 24F74 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 138.0.7204.184

[✓] Network resources
    • All expected network resources are available.

How to reproduce?

Try it in Android 15 with limited permissions
Create a page where only permitted images will be shown
Provide an option to add more images/videos (by granting permission)
Declare PhotoManager.addChangeCallback(_onChange) in initState
In the _onChange function, reload granted photos.

Logs

Example code (optional)

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.WRITE_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />



@override
void onInit() async {
  super.onInit();

  albumChangedListener = (MethodCall call) {
    LogUtils.debug("PhotoManager, album has CHANGED", tag: "AlbumLogic");
    refreshAlbum();
  };
  PhotoManager.addChangeCallback(albumChangedListener);
  PhotoManager.startChangeNotify();
  LogUtils.debug("INT", tag: "AlbumLogic");
  refreshAlbum();
}

Contact

[email protected]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions