3
1

Jetpack Comopseで通知設定画面への遷移処理を書く

Posted at

はじめに

今回は、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内でアプリの通知設定画面を開く方法を紹介していきました
どなたかのお役に立てれば幸いです

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1