Android 12 下载文件报错
774312674 opened this issue · 4 comments
774312674 commented
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 commented
目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE
geeklx commented
目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE
怎么写,请指点~谢谢
774312674 commented
目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE
声明 PendingIntent 可变性怎么写,请指点~谢谢
创建通知时报错,可以设置setEnableIndicator(false)不创建通知 ,或者在源码中的PendingIntent
geeklx commented
目标平台 12+ 需要在创建 PendingIntent 传入 PendingIntent.FLAG_MUTABLE 或者 PendingIntent.FLAG_IMMUTABLE
声明 PendingIntent 可变性怎么写,请指点~谢谢
创建通知时报错,可以设置setEnableIndicator(false)不创建通知 ,或者在源码中的PendingIntent
挖槽 感谢大佬指点