首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用oracle maf实现推送通知

使用oracle maf实现推送通知
EN

Stack Overflow用户
提问于 2016-03-03 16:03:07
回答 2查看 184关注 0票数 0

我可以使用device token.but注册,我没有收到来自服务器的消息。我已经向GCM注册了我的项目,并获得了项目Id和服务器密钥。

在此处输入代码

代码语言:javascript
复制
public void onMessage(Event event) {
    String msg;
    msg = event.getPayload();
    System.out.println("#### Message from the Server :" + msg);
    String one="";
    AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureId(), "usercheck", new Object[]{msg});
    // Parse the payload of the push notification
    HashMap payload = null;
    String pushMsg = "No message received";
    try
    {
      payload = (HashMap)JSONBeanSerializationHelper.fromJSON(HashMap.class, msg);
      pushMsg = (String)payload.get("alert");
    }
    catch(Exception e) {
        e.printStackTrace();
    }
    // Write the push message to app scope to display to the user        
    AdfmfJavaUtilities.setELValue("#{applicationScope.pushMessage}", pushMsg);
}

public void onError(AdfException adfException) {
    System.out.println("#### Error: " + adfException.toString());
    // Write the error into app scope        
    AdfmfJavaUtilities.setELValue("#{applicationScope.errorMessage}", adfException.toString());

}

public void onOpen(String token) {
    System.out.println("#### Registration token:" + token);
    // Clear error in app scope
    AdfmfJavaUtilities.setELValue("#{applicationScope.errorMessage}", null);

    // Write the token into app scope
    AdfmfJavaUtilities.setELValue("#{applicationScope.deviceToken}", token);
}

}

EN

回答 2

Stack Overflow用户

发布于 2016-03-10 21:17:47

我想this article会帮你的。我可以为GCM完成它们,但还不能为APN完成。

要注册Google Cloud Messaging,请转到this link,然后单击"Get configuration“按钮。

在服务器应用程序中,正确设置设备令牌和发送者id。消息是使用它们发送的。

票数 0
EN

Stack Overflow用户

发布于 2016-04-06 15:34:30

既然你从服务器得到了deviceId,那么我认为问题不是代码的问题。您是否在maf-application.xml中启用了PushPlugin

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35766405

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档