Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to create BigPictureStyle Notification in Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 731
    Comment on it

    To show large-format notifications in android notification bar similar like Flipkart, Mobikwik, Paytm applications. The style of large icon notification bar is called BigPicturestyle Notifications. Mostly the BigPicturestyle Notification is used to show breif information about the content in the application in the form of image.

    When the user taps the notification we have to show the Home Screen of our App, this job can be done with the help of the following Intent.

    notificationManager = NotificationManagerCompat.from(this);
        Intent notificationIntent = new Intent(this.getApplicationContext(), MainActivity.class);
        notificationIntent.putExtra("start_id", startid);
        Notification notification = new Notification(R.drawable.ic_launcher, "See My App something for you", startid);
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pendingNotificationIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, notificationIntent,
        notification.flags = Notification.FLAG_GROUP_SUMMARY;

    Get the bitmap to show in notification bar, which needs to be shown as Big Picture

        Bitmap bitmap_image = BitmapFactory.decodeResource(this.getResources(), R.drawable.funny_android);
        NotificationCompat.BigPictureStyle s = new NotificationCompat.BigPictureStyle().bigPicture(bitmap_image);

    Create a Notification object and set notification icon, title, text etc...

        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
            notification = builder.setContentIntent(pendingNotificationIntent)
                    .setContentTitle("Set title")
                    .setContentText("Set Content text")
        notificationManager.notify(startid, notification);
        return startid;

    With the help of library we can implement for all the android devices.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: