diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ce47978509bd6c9b182edfcd0159d342fa9fd970..9faa4a111f2839623e7233b2cefaf0279404ac22 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -17,9 +17,9 @@ Set custom default icon. This is used when no icon is set for incoming notification messages. See README(https://goo.gl/l4GJaQ) for more. --> - <!-- <meta-data --> - <!-- android:name="com.google.firebase.messaging.default_notification_icon" --> - <!-- android:resource="@drawable/logo" /> --> + <meta-data + android:name="com.google.firebase.messaging.default_notification_icon" + android:resource="@mipmap/chatman_launcher_round" /> <!-- <!– Set color used with incoming notification messages. This is used when no color is set for the incoming --> <!-- notification message. See README(https://goo.gl/6BKBk7) for more. –> --> <!-- <meta-data --> diff --git a/android/app/src/main/java/com/chatman/service/PushNotificationService.java b/android/app/src/main/java/com/chatman/service/PushNotificationService.java index 4d73cbf329c44fc329a3385a35e347c8ddf2f26f..58ee1a604eaa86b83df572d1f5054cae8b852828 100644 --- a/android/app/src/main/java/com/chatman/service/PushNotificationService.java +++ b/android/app/src/main/java/com/chatman/service/PushNotificationService.java @@ -7,12 +7,16 @@ import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; +import android.graphics.Bitmap; import android.graphics.Color; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.IBinder; import android.support.v4.app.NotificationCompat; +import android.support.v4.content.ContextCompat; import android.util.Log; import com.chatman.MainActivity; @@ -84,11 +88,15 @@ public class PushNotificationService extends FirebaseMessagingService { PendingIntent.FLAG_UPDATE_CURRENT); // Build the notification with all of the parameters. + Drawable drawable= ContextCompat.getDrawable(this,R.mipmap.chatman_launcher_round); + Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap(); + NotificationCompat.Builder notifyBuilder = new NotificationCompat .Builder(this, getString(R.string.default_notification_channel_id)) .setContentTitle(title) .setContentText(text) - .setSmallIcon(R.drawable.ic_launcher_foreground) + .setSmallIcon(R.mipmap.chatman_launcher_round) + .setLargeIcon(bitmap) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setAutoCancel(true).setContentIntent(notificationPendingIntent) .setPriority(NotificationCompat.PRIORITY_HIGH)