Skip to content
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

Open overlay causes crashing when upgrade Android SDK to 34 #120

Open
ducviet321 opened this issue Jul 18, 2024 · 2 comments
Open

Open overlay causes crashing when upgrade Android SDK to 34 #120

ducviet321 opened this issue Jul 18, 2024 · 2 comments

Comments

@ducviet321
Copy link

Can be fixed in android/src/main/java/flutter/overlay/window/flutter_overlay_window/OverlayService.java

Find and Replace

        startForeground(OverlayConstants.NOTIFICATION_ID, notification);

To

        if (Build.VERSION.SDK_INT >= 34) {
            startForeground(
                    OverlayConstants.NOTIFICATION_ID,
                    notification,
                    ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
        } else {
            startForeground(
                    OverlayConstants.NOTIFICATION_ID,
                    notification);
        }

And add import import android.content.pm.ServiceInfo;

@ducviet321 ducviet321 changed the title Crashing when upgrade android SDK to 34 Open overlay causes crashing when upgrade Android SDK to 34 Jul 18, 2024
@X-SLAYER
Copy link
Owner

Thank you for bringing up this issue and suggesting a solution!
Could you please open a Pull Request (PR) with the following changes? This will allow everyone to benefit from the fix.

@harshmdr
Copy link

harshmdr commented Aug 7, 2024

Please upgrade package with above fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants