Advertisement
Guest User

on-message-received-java

a guest
Mar 25th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. ...
  2. public void onMessageReceived(RemoteMessage remoteMessage) {
  3.  
  4.         Intent intent = new Intent(this, ActivityQuePodeIniciarAberturaDeLink.class);
  5.         intent.putExtra( "URL", remoteMessage.getData().get("link") );
  6.  
  7.         PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
  8.  
  9.         NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
  10.             // .setSmallIcon( R.drawable.qualquer_icone )
  11.             .setTicker( "Abrir URL" )
  12.             .setContentTitle( "Abrir URL" )
  13.             .setContentText( "Abrir URL no YouTube" )
  14.             // .setLargeIcon( bitmapQualquer )
  15.             .setContentIntent( pendingIntent );
  16.  
  17.         NotificationManager notifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  18.         notifyManager.notify( 0, builder.build() );
  19.     }
  20. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement