Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Intent resultIntent = new Intent(cont, Notifications.class);
- TaskStackBuilder stackBuilder = TaskStackBuilder.create(cont);
- stackBuilder.addNextIntentWithParentStack(resultIntent);
- PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_ONE_SHOT);
- NotificationCompat.Builder mBuilder =
- (NotificationCompat.Builder) new NotificationCompat.Builder(cont)
- .setSmallIcon(R.drawable.ic_notification)
- .setAutoCancel(true)
- .setPriority(Notification.PRIORITY_MAX)
- .setContentIntent(resultPendingIntent);
- mBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
- // here's our vibration pattern, I made it myself (the only thing I did)
- long[] vibration_pattern = {500, 500, 300, 700, 2400, 600, 300, 500};
- mBuilder.setVibrate(vibration_pattern);
- this.notiBuild = mBuilder;
- this.cont = cont;
- NotificationManager notificationManager = (NotificationManager) this.cont.getSystemService(cont.NOTIFICATION_SERVICE);
- notificationManager.notify(this.id, this.notiBuild.build());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement