From 5b49e2eb2db829b2b386a707d79a52f72a2ef0e3 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Thu, 20 Jan 2022 01:26:29 -0600 Subject: Properly implemented save and share report actions --- androidApp/src/google/AndroidManifest.xml | 15 ++++++++++++++- androidApp/src/google/java/ManagerMessagingService.kt | 19 +++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'androidApp/src/google') diff --git a/androidApp/src/google/AndroidManifest.xml b/androidApp/src/google/AndroidManifest.xml index f7aea6c..ce72a8b 100644 --- a/androidApp/src/google/AndroidManifest.xml +++ b/androidApp/src/google/AndroidManifest.xml @@ -7,7 +7,10 @@ + tools:ignore="GoogleAppIndexingWarning" + android:allowBackup="false" + android:icon="@mipmap/ic_launcher" + android:fullBackupContent="false"> + + + + 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) { -- cgit v1.2.3