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

android12崩溃,PendingIntent标志位需要适配 #147

Open
suyxin opened this issue Oct 11, 2022 · 8 comments
Open

android12崩溃,PendingIntent标志位需要适配 #147

suyxin opened this issue Oct 11, 2022 · 8 comments

Comments

@suyxin
Copy link

suyxin commented Oct 11, 2022

java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
    at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461)
    at android.app.PendingIntent.getActivity(PendingIntent.java:447)
    at android.app.PendingIntent.getActivity(PendingIntent.java:411)
    at com.github.moduth.blockcanary.DisplayService.onBlock(DisplayService.java:46)
    at com.github.moduth.blockcanary.BlockCanaryInternals$1.onBlockEvent(BlockCanaryInternals.java:67)
    at com.github.moduth.blockcanary.LooperMonitor$1.run(LooperMonitor.java:80)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:233)
    at android.os.Looper.loop(Looper.java:344)
    at android.os.HandlerThread.run(HandlerThread.java:67)
@suyxin
Copy link
Author

suyxin commented Oct 11, 2022

PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, FLAG_UPDATE_CURRENT);
需要适配为

@suyxin
Copy link
Author

suyxin commented Oct 11, 2022

PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, FLAG_IMMUTABLE | FLAG_UPDATE_CURRENT);

@sunmTree
Copy link

作者不更新了吗

@ideav5
Copy link

ideav5 commented Mar 22, 2023 via email

@Jsonjia
Copy link

Jsonjia commented May 8, 2023

+1

@ideav5
Copy link

ideav5 commented May 8, 2023 via email

@uidq1290
Copy link

uidq1290 commented May 8, 2023 via email

@mhz-tiantian
Copy link

+1 一样的问题

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

6 participants