Skip to content

Instantly share code, notes, and snippets.

private void sendNotificationWithSmallIcon(String title, String messageBody)
{
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.user);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(largeIcon)
.setContentTitle(title)
.setAutoCancel(true)
.setContentText(messageBody);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment