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

Android 12 下载文件报错 #1001

Closed
774312674 opened this issue Jul 17, 2022 · 4 comments
Closed

Android 12 下载文件报错 #1001

774312674 opened this issue Jul 17, 2022 · 4 comments

Comments

@774312674
Copy link

java.lang.IllegalArgumentException: com.xxx: 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:375)
    at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
    at android.app.PendingIntent.getActivity(PendingIntent.java:444)
    at android.app.PendingIntent.getActivity(PendingIntent.java:408)
    at com.download.library.DownloadNotifier.initBuilder(DownloadNotifier.java:110)
    at com.download.library.DownloadTask.createNotifier(DownloadTask.java:507)
    at com.download.library.DownloadSubmitterImpl$DownloadStartTask.run(DownloadSubmitterImpl.java:178)
    at com.download.library.DownloadSubmitterImpl$1.run(DownloadSubmitterImpl.java:93)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)
@AyakaAgo
Copy link

目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE

声明 PendingIntent 可变性

@geeklx
Copy link

geeklx commented Aug 27, 2022

目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE

声明 PendingIntent 可变性

怎么写,请指点~谢谢

@774312674
Copy link
Author

目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE
声明 PendingIntent 可变性

怎么写,请指点~谢谢

创建通知时报错,可以设置setEnableIndicator(false)不创建通知 ,或者在源码中的PendingIntent

@geeklx
Copy link

geeklx commented Aug 27, 2022

目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE
声明 PendingIntent 可变性

怎么写,请指点~谢谢

创建通知时报错,可以设置setEnableIndicator(false)不创建通知 ,或者在源码中的PendingIntent

挖槽 感谢大佬指点

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

4 participants