일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Linux
- Coroutine
- kotlin
- 장자명언
- 좋은글필사하기
- 이모지메모
- 코틀린
- 소울칼리버6
- 1인개발자
- 벤자민플랭클린
- Android
- Firebase
- 공자명언
- jetpack compose
- 공부집중
- DART
- ASMR
- 파이썬
- Streaming
- Flutter
- bash
- Freesound
- 이모지
- recyclerview
- 명언모음
- androidx
- 오픈소스
- 명심보감
- FSM
- 넷플릭스
Archives
- Today
- Total
Vintage appMaker의 Tech Blog
[Android 12] Pending Intent 적용정책 본문
Source code or Tip/Android(Java, Kotlin)
[Android 12] Pending Intent 적용정책
VintageappMaker 2022. 4. 4. 11:25
2022-04-04 20:09:18.803 5256-5256/com.psw.batteryToast E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.psw.batteryToast, PID: 5256
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.psw.batteryToast/com.psw.batteryToast.MainActivity}: java.lang.IllegalArgumentException: com.psw.batteryToast: 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.ActivityThread.performLaunchActivity(ActivityThread.java:3635)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.IllegalArgumentException: com.psw.batteryToast: 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.getBroadcastAsUser(PendingIntent.java:645)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
at com.psw.batteryToast.MainActivity.onCreate(MainActivity.kt:85)
at android.app.Activity.performCreate(Activity.java:8051)
at android.app.Activity.performCreate(Activity.java:8031)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
... 12 more
Android SDK 31 이상을 사용할 경우,
Pending Intent 파라메터로 FLAG_IMMUTABLE 을 강권하고 있다.
예외가 있긴하지만 대부분 그렇게 해야 한다.
Android SDK 31이하에서는 문제가 없지만, Google Play에서 받아주지 않는다.
그러므로 마켓 업로드하려면 위의 코드는 반드시 적용되어야 한다.
'Source code or Tip > Android(Java, Kotlin)' 카테고리의 다른 글
[Android] SQLite를 편하게, Room 빠르게 사용하기 (0) | 2022.04.15 |
---|---|
[Android] BottomNavigationView의 onBackPressed처리 (0) | 2022.04.08 |
[링크] Android Espresso 자료모음 (0) | 2022.03.20 |
[Android] 화면캡쳐 방지 (0) | 2022.01.10 |
[Android] Logcat 소스와 연동(링크)하기 (0) | 2021.12.29 |
Comments