블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2731)
Unity3D (814)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (57)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (51)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
03-29 00:00

[사용엔진] Unity 2020.3.37f1

-------------------------------------------------------------------------------------------

[추가]

Push 관련해서 같은 에러가 나서 확인해보니 아래 링크와 같은 처리를 요구하고 있다.

 

1. Android 12 이상에 대해서 PendingIntent 를 PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE 추가

2. AndroidManifest.xml  SCHEDULE_EXACT_ALARM 퍼미션 추가

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

>> 1.2. 둘다 처리가 필요할 듯 하다.

 

 

[참조] https://github.com/radishmedia/react-native-push-notification/pull/19

 

fix: fix for not receiving notification on android 12 by tjkang · Pull Request #19 · radishmedia/react-native-push-notificatio

Description 안드로이드에서 sdk version 을 31 로 업그레이드하고 compileSdkVersion = 31 targetSdkVersion = 31 notification 이 수신이 안되는 이슈입니다 이는 안드로이드 12 이상에 대해서 PendingIntent 를 PendingIntent.F

github.com

-------------------------------------------------------------------------------------------

 

구글에서 API 31을 쓰라고 해서 Target API를 31로 올리고 빌드 했는데,

실행은 되지만 최신 폰(좀 안좋은 폰은 정상)에서 실행 중 아래와 같은 에러메시지를 띄우면서 크래시가 남.

----

AndroidJavaException: java.lang.IllegalArgumentException: com.xxx.xxx.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.
    java.lang.IllegalArgumentException: com.xxx.xxx.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.

----

이리저리 찾아보니 크게 2가지 처리를 하는 것 같다.

1. AndroidManifest.xml에 exported 명시적으로 설정

2. gradle의 dependencies {}에 androidx.work:work-runtime:2.7.0 라이브러리 추가(for Java)

    - 2.7.0부터 Android 12(API31)대응을 해서 2.7.0이상을 추가하면 되는 듯

    - Unity는 mainTemplate.gradle의 dependencies {...}에 추가

    - 라이브러리 선택 사항

       = [Java] implementation 'androidx.work:work-runtime:2.7.0'  // for Unity

       = [Kotlin] implementation 'androidx.work:work-runtime-ktx:2.7.0

 

 

내 경우는 exported 관련은 이미 돼 있어서 아래와 같이 androidx.work:work-runtime:2.7.1(현재 기준 공식 최신버전)을 추가하고 해결 했다.

mainTemplete.gradle

    dependencies{

    ....

    implementation 'androidx.work:work-runtime:2.7.1'    // for Java

    ....

    }

 

[참조] https://textbox.tistory.com/entry/android-%EC%8B%A4%ED%96%89%EC%98%A4%EB%A5%98-version-31%EC%97%90%EC%84%9C-%EC%95%B1-%EC%8B%A4%ED%96%89%EC%8B%9C-%EC%98%A4%EB%A5%98

[참조] https://bacassf.tistory.com/166

[참조] https://onlyfor-me-blog.tistory.com/467

[참조] https://stackoverflow.com/questions/68228666/targeting-s-version-10000-and-above-requires-that-one-of-flag-immutable-or-fl

반응형
Posted by blueasa
, |