Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created December 30, 2016 08:29
Show Gist options
  • Select an option

  • Save miquelbeltran/63ffdedd20add0e76629e33f38177c9a to your computer and use it in GitHub Desktop.

Select an option

Save miquelbeltran/63ffdedd20add0e76629e33f38177c9a to your computer and use it in GitHub Desktop.
public class NotificationService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Notification notification = new NotificationCompat.Builder(this)
.setContentTitle(remoteMessage.getNotification().getTitle())
.setContentText(remoteMessage.getNotification().getBody())
.setSmallIcon(R.mipmap.ic_launcher)
.build();
NotificationManagerCompat manager = NotificationManagerCompat.from(getApplicationContext());
manager.notify(123, notification);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment