A much more detailed notification

This commit is contained in:
2026-02-27 07:05:08 +08:00
parent 9cc99e612a
commit dab43a7f30
9 changed files with 178 additions and 41 deletions
+1 -1
View File
@@ -47,7 +47,7 @@
android:value="2" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="tasq_custom_sound_channel_2" />
android:value="tasq_custom_sound_channel_3" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
@@ -4,6 +4,7 @@ import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import android.media.AudioAttributes
import android.util.Log
import android.net.Uri
class App : Application() {
@@ -13,7 +14,7 @@ class App : Application() {
}
private fun createTasqChannel() {
val channelId = "tasq_custom_sound_channel"
val channelId = "tasq_custom_sound_channel_3"
val name = "TasQ notifications"
val importance = NotificationManager.IMPORTANCE_HIGH
val channel = NotificationChannel(channelId, name, importance)
@@ -25,8 +26,13 @@ class App : Application() {
.build()
channel.setSound(soundUri, audioAttributes)
// Ensure we do NOT bypass Do Not Disturb — let the system enforce silent/vibrate modes
channel.setBypassDnd(false)
// Allow vibration; system will respect device vibrate settings
channel.enableVibration(true)
val nm = getSystemService(NotificationManager::class.java)
nm?.createNotificationChannel(channel)
Log.d("App", "Created notification channel: $channelId with sound=$soundUri")
}
}