Wednesday, 5 October 2016

Android Notification

Intent intenT = new Intent(this, Target.class);

PendingIntent pi = PendingIntent.getActivity(NotifyService.this, 0, intenT, PendingIntent.FLAG_UPDATE_CURRENT);
                Resources r = getResources();

                Notification notification = new NotificationCompat.Builder(NotifyService.this)
                        .setTicker("Jobs Updates Founds")
                        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
                        .setSmallIcon(R.mipmap.ic_launcher)
                        .setContentTitle(arrayList_Title.get(0))
                        .setPriority(Notification.PRIORITY_MAX)
                        .setVibrate(new long[]{100, 100})
                        .setStyle(new NotificationCompat.BigTextStyle())
                        .setContentIntent(pi)
                        .setAutoCancel(true)
                        .build();
                NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
                notificationManager.notify(0, notification);

No comments:

Post a Comment