Essential Android Firebase Cloud Messaging edit forum

This code that i have implemnted in my app for pushing imagemessage and also link for opening in your webView

This is my FirebaseMessagingService

public class MyFirebaseMessagingService extends FirebaseMessagingService { 
Bitmap bitmap;
public void onMessageReceived(RemoteMessage remoteMessage) {
String message = remoteMessage.getData().get("message");
//imageUri will contain URL of the image to be displayed with Notification 
String imageUri = remoteMessage.getData().get("image");
String link=remoteMessage.getData().get("link");

//To get a Bitmap image from the URL received 
bitmap = getBitmapfromUrl(imageUri);
sendNotification(message, bitmap,link);


* Create and show a simple notification containing the received FCM message. 

private void sendNotification(String messageBody, Bitmap image, String link) {
Intent intent = new Intent(this, NewsListActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
        .setLargeIcon(image)/*Notification icon image*/
        .setStyle(new NotificationCompat.BigPictureStyle()
                .bigPicture(image))/*Notification with Image*/
NotificationManager notificationManager =
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

notificationManager.notify(0 /* ID of notification */,;
public Bitmap getBitmapfromUrl(String imageUrl) {
try { 
    URL url = new URL(imageUrl);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    InputStream input = connection.getInputStream();
    Bitmap bitmap = BitmapFactory.decodeStream(input);
    return bitmap;

} catch (Exception e) {
    // TODO Auto-generated catch block 
    return null; 


And this is MainActivity to open link in my WebView or other browser depand on your requirement through intents.

if (getIntent().getExtras() != null) {
    if (getIntent().getStringExtra("LINK")!=null) {
        Intent i=new Intent(this,BrowserActivity.class);
Firebase Cloud Messaging/
Firebase Cloud Messaging
Set Up a Firebase Cloud Messaging Client App on Android
Receive Messages
Registration token
This code that i have implemnted in my app for pushing imagemessage and also link for opening in your webView
Subscribe to a topic

Table Of Contents
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
208 Firebase Cloud Messaging
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close