我已经在我的应用程序中实现了这个代码,用于推送 imagemessage 以及在 webView 中打开的链接

这是我的 FirebaseMessagingService

    public class MyFirebaseMessagingService extends FirebaseMessagingService { 
Bitmap bitmap;
@Override 
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);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.putExtra("LINK",link);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);
    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setLargeIcon(image)/*Notification icon image*/
            .setSmallIcon(R.drawable.hindi)
            .setContentTitle(messageBody)
            .setStyle(new NotificationCompat.BigPictureStyle()
                    .bigPicture(image))/*Notification with Image*/
            .setAutoCancel(true) 
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
 
    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
} 
public Bitmap getBitmapfromUrl(String imageUrl) {
    try { 
        URL url = new URL(imageUrl);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setDoInput(true);
        connection.connect();
        InputStream input = connection.getInputStream();
        Bitmap bitmap = BitmapFactory.decodeStream(input);
        return bitmap;
 
    } catch (Exception e) {
        // TODO Auto-generated catch block 
        e.printStackTrace();
        return null; 
 
    } 
}} 

这是 MainActivity 在我的 WebView 或其他浏览器中打开链接,并通过意图来满足你的需求。

if (getIntent().getExtras() != null) {
    if (getIntent().getStringExtra("LINK")!=null) {
        Intent i=new Intent(this,BrowserActivity.class);
        i.putExtra("link",getIntent().getStringExtra("LINK"));
        i.putExtra("PUSH","yes");
        NewsListActivity.this.startActivity(i);
        finish();
    }}