투케이2K

474. (kotlin/코틀린) [유틸 파일] goAppNotificationSettingIntent : 앱 알림 설정 창 인텐트 이동 수행 본문

Kotlin

474. (kotlin/코틀린) [유틸 파일] goAppNotificationSettingIntent : 앱 알림 설정 창 인텐트 이동 수행

투케이2K 2024. 4. 8. 19:33
반응형

[개발 환경 설정]

개발 툴 : AndroidStudio

개발 언어 : Kotlin

 

[소스 코드]

 

        // -----------------------------------------------------------------------------------------
        // TODO [SEARCH FAST] : [goAppNotificationSettingIntent] : 앱 알림 설정 창 인텐트 이동
        // -----------------------------------------------------------------------------------------
        fun goAppNotificationSettingIntent(mContext: Context) {

            /**
             * // -----------------------------------------
             * [goAppNotificationSettingIntent 메소드 설명]
             * // -----------------------------------------
             * 1. 앱 알림 설정 창 인텐트 이동 메소드
             * // -----------------------------------------
             * 2. 호출 방법 : C_Intent.goAppNotificationSettingIntent(A_Intro@this)
             * // -----------------------------------------
             */

            try {
                // ===============================================================
                S_Log._F_(mContext, "앱 알림 설정 창 인텐트 이동 실시", null)
                // ===============================================================

                // [애플리케이션 알림 설정창 이동]
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                    val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
                    intent.putExtra(Settings.EXTRA_APP_PACKAGE, mContext.packageName)
                    mContext.startActivity(intent)
                }

            } catch (e: Exception) {

                // [수행할 수 있는 컴포넌트 없음]
                S_Log._printStackTrace_(mContext, S_FinalMsg.LOG_BUG_STATE, null, e)
            }
        }

 

반응형
Comments