Big Picture Notification in android -


i have done android push notification using fcm.but when trying big picture notification it's not showing full image in notificationn bar.left , right side of image getting cropped.please let me know how fix issue.i tried giving 512*256 image , 600*300 size images.

i have used glide library loading image url... have loaded image using big picture notification.

public class imagenotification extends appcompatactivity {     public bitmap image ,bmp;     public notificationcompat.builder nb;     final string url = "https://www.google.es/images/srpr/logo11w.png";      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_image_notification);       }      public void createnotification(view view) {         // prepare intent triggered if         // notification selected         intent intent = new intent(this, notificationreceiveractivity.class);         pendingintent pintent = pendingintent.getactivity(this, (int) system.currenttimemillis(), intent, 0);          nb = new notificationcompat.builder(this);         nb.setsmallicon(r.drawable.icon);         nb.setcontenttitle("image notification");         nb.setcontenttext("set content text");         nb.setticker("set ticker text");           glide.                 with(this).                 load(url).                 asbitmap()                 .centercrop()                 .into(new simpletarget<bitmap>(100,100) {                           @override                           public void onresourceready(bitmap resource, glideanimation<? super bitmap> glideanimation) {                                notificationcompat.bigpicturestyle bps = new notificationcompat.bigpicturestyle().bigpicture(resource);                               bps.setsummarytext("summary text appears on expanding notification");                               nb.setstyle(bps);                            }                       });               taskstackbuilder tsb = taskstackbuilder.create(this);         tsb.addparentstack(imagenotification.class);         // adds intent starts activity top of stack         tsb.addnextintent(intent);         pendingintent resultpendingintent =                 tsb.getpendingintent(                         0,                         pendingintent.flag_update_current                 );          nb.setcontentintent(resultpendingintent);         nb.setautocancel(true);         nb.setdefaults(notification.default_lights | notification.default_vibrate);         uri alarmsound = ringtonemanager.getdefaulturi(ringtonemanager.type_notification);         nb.setsound(alarmsound, audiomanager.stream_music);         notificationmanager mnotificationmanager =                 (notificationmanager) this.getsystemservice(context.notification_service);         // mid allows update notification later on.         mnotificationmanager.notify(11221, nb.build());     }  } 

if loading image mipmap or drawable can replace code written glide library using below code

bitmap bitmap_image = bitmapfactory.decoderesource(this.getresources(), r.drawable.picture);       notificationcompat.bigpicturestyle s = new notificationcompat.bigpicturestyle().bigpicture(bitmap_image);        s.setsummarytext("summary text appears on expanding notification");         nb.setstyle(s); 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -