Skip to content
Snippets Groups Projects
Commit bd5c2140 authored by priagungs's avatar priagungs
Browse files

modified notif icon

parent 702340e6
No related merge requests found
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
Set custom default icon. This is used when no icon is set for incoming notification messages. Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. See README(https://goo.gl/l4GJaQ) for more.
--> -->
<!-- <meta-data --> <meta-data
<!-- android:name="com.google.firebase.messaging.default_notification_icon" --> android:name="com.google.firebase.messaging.default_notification_icon"
<!-- android:resource="@drawable/logo" /> --> android:resource="@mipmap/chatman_launcher_round" />
<!-- &lt;!&ndash; Set color used with incoming notification messages. This is used when no color is set for the incoming --> <!-- &lt;!&ndash; 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. &ndash;&gt; --> <!-- notification message. See README(https://goo.gl/6BKBk7) for more. &ndash;&gt; -->
<!-- <meta-data --> <!-- <meta-data -->
......
...@@ -7,12 +7,16 @@ import android.app.PendingIntent; ...@@ -7,12 +7,16 @@ import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log; import android.util.Log;
import com.chatman.MainActivity; import com.chatman.MainActivity;
...@@ -84,11 +88,15 @@ public class PushNotificationService extends FirebaseMessagingService { ...@@ -84,11 +88,15 @@ public class PushNotificationService extends FirebaseMessagingService {
PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT);
// Build the notification with all of the parameters. // 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 NotificationCompat.Builder notifyBuilder = new NotificationCompat
.Builder(this, getString(R.string.default_notification_channel_id)) .Builder(this, getString(R.string.default_notification_channel_id))
.setContentTitle(title) .setContentTitle(title)
.setContentText(text) .setContentText(text)
.setSmallIcon(R.drawable.ic_launcher_foreground) .setSmallIcon(R.mipmap.chatman_launcher_round)
.setLargeIcon(bitmap)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setAutoCancel(true).setContentIntent(notificationPendingIntent) .setAutoCancel(true).setContentIntent(notificationPendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH) .setPriority(NotificationCompat.PRIORITY_HIGH)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment