Skip to content
Snippets Groups Projects
Unverified Commit d965427f authored by Tim Brüggenthies's avatar Tim Brüggenthies Committed by GitHub
Browse files

Moves creation of notification channel to app startup (#32)

parent 1bbbd504
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package de.rki.coronawarnapp
import android.app.Application
import android.content.Context
import de.rki.coronawarnapp.notification.NotificationHelper
class CoronaWarnApplication : Application() {
......@@ -13,6 +14,7 @@ class CoronaWarnApplication : Application() {
override fun onCreate() {
instance = this
NotificationHelper.createNotificationChannel()
super.onCreate()
}
}
......@@ -128,7 +128,6 @@ object NotificationHelper {
* @param visibility: Int
*/
fun sendNotification(title: String, content: String, visibility: Int) {
createNotificationChannel()
val notification = buildNotification(title, content, visibility) ?: return
with(NotificationManagerCompat.from(CoronaWarnApplication.getAppContext())) {
notify(Random.nextInt(), notification)
......
......@@ -150,7 +150,6 @@ class MainFragment : BaseFragment() {
NotificationManagerCompat.from(requireContext()).areNotificationsEnabled()
.toString()
)
NotificationHelper.createNotificationChannel()
NotificationHelper.sendNotification(
getString(R.string.notification_headline),
getString(R.string.notification_body),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment