aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/google
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-12-14 17:37:22 -0600
committerIván Ávalos <avalos@disroot.org>2022-12-14 17:37:22 -0600
commitfacf751f941a2f85d0ce236c4a61f21e84758199 (patch)
tree82c35a286310873b1d784c68e04ba69246cea830 /androidApp/src/google
parentec157026deea7b72ff233a20c0ed40fa548f75d6 (diff)
downloadetbsa-trackermap-mobile-facf751f941a2f85d0ce236c4a61f21e84758199.tar.gz
etbsa-trackermap-mobile-facf751f941a2f85d0ce236c4a61f21e84758199.tar.bz2
etbsa-trackermap-mobile-facf751f941a2f85d0ce236c4a61f21e84758199.zip
Removed unused test modules
Diffstat (limited to 'androidApp/src/google')
-rw-r--r--androidApp/src/google/java/ManagerMessagingService.kt18
1 files changed, 16 insertions, 2 deletions
diff --git a/androidApp/src/google/java/ManagerMessagingService.kt b/androidApp/src/google/java/ManagerMessagingService.kt
index 9ac4636..ff6c65f 100644
--- a/androidApp/src/google/java/ManagerMessagingService.kt
+++ b/androidApp/src/google/java/ManagerMessagingService.kt
@@ -16,13 +16,15 @@
package mx.trackermap.TrackerMap.android
import android.annotation.SuppressLint
+import android.app.NotificationManager
import android.app.PendingIntent
+import android.content.Context
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
@@ -30,6 +32,18 @@ import kotlin.time.ExperimentalTime
@ExperimentalTime
class ManagerMessagingService : FirebaseMessagingService() {
+ private fun showNotification(context: Context, id: Int, body: String?, pendingIntent: PendingIntent) {
+ val builder = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_id))
+ .setSmallIcon(R.drawable.icon_notify)
+ .setContentTitle(context.getString(R.string.app_name))
+ .setContentText(body)
+ .setAutoCancel(true)
+ .setContentIntent(pendingIntent)
+ (context.getSystemService(NOTIFICATION_SERVICE)
+ as NotificationManager)
+ .notify(id, builder.build())
+ }
+
@SuppressLint("UnspecifiedImmutableFlag")
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
@@ -40,7 +54,7 @@ class ManagerMessagingService : FirebaseMessagingService() {
}
val intent = Intent(this, UnitsActivity::class.java)
val pendingIntent = PendingIntent.getActivity(this, 0, intent, flags)
- Utils.showNotification(
+ showNotification(
this,
remoteMessage.hashCode(),
remoteMessage.notification?.body,