SHARE
TWEET

on-message-received-java

a guest Mar 25th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ...
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top