I know you can send info in the push notification parameters like message, title, image URL, etc. How does Facebook show your profile pic with your message in the notification area? I want to use an external image in the notification area, so when you pull it down you see the profile image with the message. Right now, mine just shows the default icon from the drawable folder. I figured this might be a common question but couldn't find anything. Any help would be nice.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
download image first using below code:
use that image as bitmap in below code:
i thing you k'no about android permission:
for more detail check this artical and android developer
This statement will use a method to convert a URL (naturally, one that points to an image) into a
Bitmap
.Note: Since you mention a Facebook profile, I have included an URL that gets your the large size profile picture of a Facebook User. You can however, change this to any URL that points to an image that you need to display in the
Notification
.And the method that will get the image from the URL you specified in the statement above:
Now pass the
bitmap
instance created above to theNotification.Builder
instance. I call itbuilder
in this example code. It is used in this line:builder.setLargeIcon(bitmap);
. I am assuming you know how to display the actualNotification
and it's configurations. So I will skip that part and add just the builder.Oh, almost forgot, if you haven't already done so, you will need this permission setup in the Manifest:
I used Universal Image Loader to solve this. Take a look at the wiki on how to set it up. After you instantiate it once, this is the code I use in my GCM listener to download and display the image. I download the bitmap and then set it in the notification: