aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/google/java/ManagerMessagingService.kt
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp/src/google/java/ManagerMessagingService.kt')
-rw-r--r--androidApp/src/google/java/ManagerMessagingService.kt19
1 files changed, 9 insertions, 10 deletions
diff --git a/androidApp/src/google/java/ManagerMessagingService.kt b/androidApp/src/google/java/ManagerMessagingService.kt
index 07ee427..9ac4636 100644
--- a/androidApp/src/google/java/ManagerMessagingService.kt
+++ b/androidApp/src/google/java/ManagerMessagingService.kt
@@ -16,14 +16,13 @@
package mx.trackermap.TrackerMap.android
import android.annotation.SuppressLint
-import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Intent
import android.os.Build
-import androidx.core.app.NotificationCompat
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import kotlinx.coroutines.DelicateCoroutinesApi
+import mx.trackermap.TrackerMap.android.shared.Utils
import mx.trackermap.TrackerMap.android.units.UnitsActivity
import kotlin.time.ExperimentalTime
@@ -39,14 +38,14 @@ class ManagerMessagingService : FirebaseMessagingService() {
} else {
PendingIntent.FLAG_ONE_SHOT
}
- val pendingIntent = PendingIntent.getActivity(this, 0, Intent(this, UnitsActivity::class.java), flags)
- val builder = NotificationCompat.Builder(this, getString(R.string.notification_channel_id))
- .setSmallIcon(R.drawable.icon_notify)
- .setContentTitle(getString(R.string.app_name))
- .setContentText(remoteMessage.notification?.body)
- .setAutoCancel(true)
- .setContentIntent(pendingIntent)
- (getSystemService(NOTIFICATION_SERVICE) as NotificationManager).notify(remoteMessage.hashCode(), builder.build())
+ val intent = Intent(this, UnitsActivity::class.java)
+ val pendingIntent = PendingIntent.getActivity(this, 0, intent, flags)
+ Utils.showNotification(
+ this,
+ remoteMessage.hashCode(),
+ remoteMessage.notification?.body,
+ pendingIntent
+ )
}
override fun onNewToken(token: String) {