Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bundle bundle=new Bundle();
- if(major == 48180 && minor == 14092 || major == 54602 && minor == 59234){
- bundle.putInt("image", R.drawable.oeang);
- }else if(major == 35798 && minor == 37801 || major == 21136 && minor == 51831){
- bundle.putInt("image", R.drawable.monas);
- }else{
- bundle.putInt("image", R.drawable.soekarno);
- }
- Intent notificationIntent = new Intent(this, DetailNotification.class);
- notificationIntent.putExtra("major",major);
- notificationIntent.putExtra("minor",minor);
- notificationIntent.putExtra("title", title);
- notificationIntent.putExtra("message",message);
- notificationIntent.putExtras(bundle);
- PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
- notificationIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
- Bitmap bitmap_image = BitmapFactory.decodeResource(this.getResources(), R.drawable.big_picture);
- Notification notification = new Notification.Builder(this)
- .setSmallIcon(android.R.drawable.ic_dialog_info)
- .setContentTitle(title)
- .setContentText(message)
- .setAutoCancel(true)
- .setContentIntent(pendingIntent)
- .setStyle(new Notification.BigPictureStyle()
- .bigPicture(bitmap_image))
- .build();
- notification.defaults |= Notification.DEFAULT_SOUND;
- NotificationManager notificationManager =
- (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(2, notification);
Advertisement
Add Comment
Please, Sign In to add comment