【问题标题】:how to send a notification to android using fcm and j2ee [closed]如何使用 fcm 和 j2ee 向 android 发送通知 [关闭]
【发布时间】:2016-09-04 13:28:59
【问题描述】:

我想构建一个应用程序以将通知从 j2ee Web 应用程序发送到我们的客户端应用程序 android。

我找到了很多示例,但使用的是谷歌云消息传递而不是 FCM。

我想要一个例子来使用 java 中的一个简单函数来做到这一点。

此功能允许从我的服务器向我们安装在安卓设备中的移动应用发送通知。

【问题讨论】:

    标签: android firebase jakarta-ee push-notification firebase-cloud-messaging


    【解决方案1】:

    是的,您可以通过 FCM 实现。我没有使用过 j2ee,但可以给你一些指导。

    1. 配置您的应用程序以接收来自 Firebase 的通知 安慰。有很多教程可用,而且非常简单。
    2. 使用 POST 请求将通知从您的服务器发送到设备。这是json部分。

    ......

    https://fcm.googleapis.com/fcm/send
    Content-Type:application/json
    Authorization:key=AIhhjGu76G...P0Gzu7B5aAnoYUd
    {   
        "data": {
          "title": "notification_title",
          "body": "notification_body"
        },
        "to" : "jh578_gsh....jhHGFJ76FH"
    }
    

    【讨论】:

    • 您好,先生,第一步没问题,但第 2 步我不知道该怎么做
    • 你有任何使用 php 的例子
    • @MohamedElgarnaoui 你有没有找到关于如何从 java 服务器或 j2ee 发送通知到 android 设备的任何解决方案?
    • @MohamedElgarnaoui 那么请分享您的解决方案
    猜你喜欢
    • 1970-01-01
    • 2020-11-03
    • 2022-09-28
    • 2019-08-05
    • 1970-01-01
    • 2020-11-27
    • 2021-10-17
    • 2018-11-30
    • 2016-10-08
    相关资源
    最近更新 更多