はじめに
今回は、JetpackCompose実装時にCompose関数内で通知設定画面を開くための処理を紹介していきます
本文
早速ですが、コードは下記になります。
SingleTaskを設定することで二重で開かれることを阻止することができます。
val intent = Intent()
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
context.startActivity(intent)
最後に
今回は、備忘録としての役割が強いですがJetpackCompose内でアプリの通知設定画面を開く方法を紹介していきました
どなたかのお役に立てれば幸いです