Function code:
public void gerarNotificacao(Context context, Intent intent, CharSequence ticker, CharSequence titulo, CharSequence descricao){
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent p = PendingIntent.getActivity(context, 0, intent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setTicker(ticker);
builder.setContentTitle(titulo);
builder.setContentText(descricao);
builder.setSmallIcon(R.drawable.ic_launcher_background);
builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher_background));
builder.setContentIntent(p);
Notification n = builder.build();
n.vibrate = new long[]{150, 300, 150, 600};
n.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(R.drawable.ic_launcher_background, n);
try{
Uri som = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone toque = RingtoneManager.getRingtone(context, som);
toque.play();
}
catch(Exception e){}
}