如何使用oracle maf实现推送通知
How to implement push notification using oracle maf
我刚刚尝试了oracle maf提供的用于推送的示例代码notifications.I可以通过它注册但是当我传递消息时我没有收到任何消息。
这是服务器代码。我们能否解释一下如何在 gcm.I 中注册,但我对此也表示怀疑,有没有办法在 gcm
中查看消息接收的详细信息
<af:commandButton actionListener="#{bindings.Execute.execute}"
text="Refresh"
disabled="#{!bindings.Execute.enabled}"
id="ctb1" immediate="true"/>
<af:table value="#{bindings.RegistrationsView1.collectionModel}"
var="row"
rows="#{bindings.RegistrationsView1.rangeSize}"
emptyText="#{bindings.RegistrationsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.RegistrationsView1.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.RegistrationsView1.collectionModel.selectedRow}"
selectionListener="#{bindings.RegistrationsView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1"
partialTriggers="::ctb1" width="633" inlineStyle="height:189px;">
<af:column sortProperty="DeviceToken" sortable="false"
headerText="Device Token" id="c1" width="100">
<af:outputText value="#{row.DeviceToken}" id="ot5"/>
</af:column>
<af:column sortProperty="DeviceModel" sortable="false"
headerText="Device Model" id="c3" width="100">
<af:outputText value="#{row.DeviceModel}" id="ot4"/>
</af:column>
<af:column sortProperty="ApplicationId" sortable="false"
headerText="Application" id="c5" width="205">
<af:outputText value="#{row.ApplicationId}" id="ot1"/>
</af:column>
<af:column sortProperty="UserId" sortable="false"
headerText="User Id" id="c2" width="-5">
<af:outputText value="#{row.UserId}" id="ot3"/>
</af:column>
<af:column sortProperty="SenderId" sortable="false"
headerText="Sender Id" id="c4" width="100">
<af:outputText value="#{row.SenderId}" id="ot2"/>
</af:column>
</af:table>
</af:panelGroupLayout>
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
id="pgl1">
<af:panelFormLayout id="pfl1" partialTriggers="t1">
<af:panelLabelAndMessage label="#{bindings.DeviceToken.hints.label}"
id="plam4">
<af:outputText value="#{bindings.DeviceToken.inputValue}"
id="ot7"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.DeviceModel.hints.label}"
id="plam2">
<af:outputText value="#{bindings.DeviceModel.inputValue}"
id="ot6"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.UserId.hints.label}"
id="plam1">
<af:outputText value="#{bindings.UserId.inputValue}"
id="ot9"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.ApplicationId.hints.label}"
id="plam3">
<af:outputText value="#{bindings.ApplicationId.inputValue}"
id="ot8"/>
</af:panelLabelAndMessage>
<af:inputText label="Message" id="it1"
value="#{MessageBean.message}"/>
</af:panelFormLayout>
<af:commandButton text="Push Message" id="cb1"
actionListener="#{MessageBean.pushMessage}"/>
</af:panelGroupLayout>
首先,您将有两个应用程序。一个服务器应用程序 (PushServer) 和一个使用 MAF 框架实现的移动应用程序 (PushDemo)。我相信您在将 MAF 模块安装到 JDeveloper 中后找到了它们。
其次,要注册 Google 云消息服务器,转到 this link ,写下您的应用名称(默认为 PushService )和您的 Android 包名称(示例应用的默认名称是 com.oraclecorp.internal.maf.PushSample )。您将获得一个 GOOGLE API KEY ,您必须将其设置到 PushServer 应用程序中,设置到 MessageBean class 中(它在那里是一个常量称为 GOOGLE_APIKEY),以及您将写入移动应用程序的 senderId(写入 adf-config.xml - 这是一个名为 gcmSenderId 的 属性) .
您必须 运行 public 服务器(可能是 Weblogic)上的服务器项目,并让您的移动应用程序调用您的 servlet 所在的 URL - 例如:http://www.something.com/PushService-ViewController-context-root/registrations),然后在您的移动应用程序项目中,在 connections.xml 下您有两个必须编辑的字段:
<urlconnection name="SyncService_base_connection" url="http://www.something.com"/>
和
<urlconnection name="PushServiceConn" url="http://www.something.com/PushService-ViewController-context-root/registrations"/>
您在设备上启动该应用程序,然后检查该应用程序是否已注册到数据库中。然后,如果您为您的设备按下推送,您应该会直接在 Android 设备上收到这些通知。
对于 APNS 过程,事情有点复杂,但本教程可以帮助您。
谢谢,
拉兹万
在包括管理服务器(在 weblogic 服务器中)在内的所有托管服务器上启用 JSSE 后,上述问题得到解决。
我刚刚尝试了oracle maf提供的用于推送的示例代码notifications.I可以通过它注册但是当我传递消息时我没有收到任何消息。 这是服务器代码。我们能否解释一下如何在 gcm.I 中注册,但我对此也表示怀疑,有没有办法在 gcm
中查看消息接收的详细信息 <af:commandButton actionListener="#{bindings.Execute.execute}"
text="Refresh"
disabled="#{!bindings.Execute.enabled}"
id="ctb1" immediate="true"/>
<af:table value="#{bindings.RegistrationsView1.collectionModel}"
var="row"
rows="#{bindings.RegistrationsView1.rangeSize}"
emptyText="#{bindings.RegistrationsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.RegistrationsView1.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.RegistrationsView1.collectionModel.selectedRow}"
selectionListener="#{bindings.RegistrationsView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1"
partialTriggers="::ctb1" width="633" inlineStyle="height:189px;">
<af:column sortProperty="DeviceToken" sortable="false"
headerText="Device Token" id="c1" width="100">
<af:outputText value="#{row.DeviceToken}" id="ot5"/>
</af:column>
<af:column sortProperty="DeviceModel" sortable="false"
headerText="Device Model" id="c3" width="100">
<af:outputText value="#{row.DeviceModel}" id="ot4"/>
</af:column>
<af:column sortProperty="ApplicationId" sortable="false"
headerText="Application" id="c5" width="205">
<af:outputText value="#{row.ApplicationId}" id="ot1"/>
</af:column>
<af:column sortProperty="UserId" sortable="false"
headerText="User Id" id="c2" width="-5">
<af:outputText value="#{row.UserId}" id="ot3"/>
</af:column>
<af:column sortProperty="SenderId" sortable="false"
headerText="Sender Id" id="c4" width="100">
<af:outputText value="#{row.SenderId}" id="ot2"/>
</af:column>
</af:table>
</af:panelGroupLayout>
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
id="pgl1">
<af:panelFormLayout id="pfl1" partialTriggers="t1">
<af:panelLabelAndMessage label="#{bindings.DeviceToken.hints.label}"
id="plam4">
<af:outputText value="#{bindings.DeviceToken.inputValue}"
id="ot7"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.DeviceModel.hints.label}"
id="plam2">
<af:outputText value="#{bindings.DeviceModel.inputValue}"
id="ot6"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.UserId.hints.label}"
id="plam1">
<af:outputText value="#{bindings.UserId.inputValue}"
id="ot9"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.ApplicationId.hints.label}"
id="plam3">
<af:outputText value="#{bindings.ApplicationId.inputValue}"
id="ot8"/>
</af:panelLabelAndMessage>
<af:inputText label="Message" id="it1"
value="#{MessageBean.message}"/>
</af:panelFormLayout>
<af:commandButton text="Push Message" id="cb1"
actionListener="#{MessageBean.pushMessage}"/>
</af:panelGroupLayout>
首先,您将有两个应用程序。一个服务器应用程序 (PushServer) 和一个使用 MAF 框架实现的移动应用程序 (PushDemo)。我相信您在将 MAF 模块安装到 JDeveloper 中后找到了它们。
其次,要注册 Google 云消息服务器,转到 this link ,写下您的应用名称(默认为 PushService )和您的 Android 包名称(示例应用的默认名称是 com.oraclecorp.internal.maf.PushSample )。您将获得一个 GOOGLE API KEY ,您必须将其设置到 PushServer 应用程序中,设置到 MessageBean class 中(它在那里是一个常量称为 GOOGLE_APIKEY),以及您将写入移动应用程序的 senderId(写入 adf-config.xml - 这是一个名为 gcmSenderId 的 属性) .
您必须 运行 public 服务器(可能是 Weblogic)上的服务器项目,并让您的移动应用程序调用您的 servlet 所在的 URL - 例如:http://www.something.com/PushService-ViewController-context-root/registrations),然后在您的移动应用程序项目中,在 connections.xml 下您有两个必须编辑的字段:
<urlconnection name="SyncService_base_connection" url="http://www.something.com"/>
和
<urlconnection name="PushServiceConn" url="http://www.something.com/PushService-ViewController-context-root/registrations"/>
您在设备上启动该应用程序,然后检查该应用程序是否已注册到数据库中。然后,如果您为您的设备按下推送,您应该会直接在 Android 设备上收到这些通知。
对于 APNS 过程,事情有点复杂,但本教程可以帮助您。
谢谢,
拉兹万
在包括管理服务器(在 weblogic 服务器中)在内的所有托管服务器上启用 JSSE 后,上述问题得到解决。