簡體   English   中英

使用Firebase推送通知的可點擊圖片

[英]Clickable image using firebase push notification

是否可以使用Firebase推送通知通過通知發送可點擊的圖片,如果可以,我應該從哪里開始學習如何做呢?

是的你可以。 在fcm上有兩個部分的推動。 1)通知2)數據。 通知部分完全由google管理。因此您必須使用數據部分。在數據部分中發送base64圖片字符串,然后在應用中將其解碼為圖片。 見下文

if (remoteMessage.getData().size() > 0) {
            Log.d(TAG, "Message data payload: " + remoteMessage.getData());
Jsonobject obj=new JsonObject(remoteMessage.getData());
String image=obj.getString(“image_base64_string”);
//which you have to send from your backend or firebase console using this key
//then decode this image to bitmap and setimage to the imageview
        }

        // Check if message contains a notification payload.
        if (remoteMessage.getNotification() != null) {
            Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
        }

是的,您可以在通知有效負載中發送"click_action" => "http://google.com" ,以將click_action定向到通知以及用戶輕按收到的通知后要重定向的任何位置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM