Skip to content

[android_alarm_manager_plus] Calling AndroidAlarmManager.initialize() causes multiple calls to onAttachedToEngine in other plugins #150674

@Rexios80

Description

@Rexios80

Steps to reproduce

  1. Create a plugin with an example
  2. Add android_alarm_manager_plus to the example
  3. Call AndroidAlarmManager.initialize()
  4. See that onAttachedToEngine is called multiple times in your plugin

Expected results

The onAttachedToEngine method is called once and only once

Actual results

The onAttachedToEngine method is called many times

Code sample

https://github.com/Rexios80/multiple_attach_test

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale
    en-US)
    • Flutter version 3.22.2 on channel stable at
      /Users/rexios/fvm/versions/3.22.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (3 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/rexios/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio
      Preview.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Build 16A5171c
    • CocoaPods version 1.15.2

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

[!] Android Studio (version unknown)
    • Android Studio at /Applications/Android Studio Preview.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
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build
      17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.90.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (5 available)
    • SM G975U1 (mobile)              • R58M36QDM2Y               •
      android-arm64  • Android 12 (API 31)
    • Aaron’s iPhone (mobile)         • 00008130-001C35CE3A20001C • ios
      • iOS 17.5.1 21F90
    • macOS (desktop)                 • macos                     • darwin-arm64
      • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin
      • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                    •
      web-javascript • Google Chrome 125.0.6422.142
    ! Error: Browsing on the local area network for Raj's Apple Vision Pro.
      Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac. (code -27)
    ! Error: Browsing on the local area network for Joe’s iPhone. Ensure the
      device is unlocked and attached with a cable or associated with the same
      local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code
      -27)

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

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions