2016-02-11 25 views
0

我剛剛嘗試了oracle maf提供的示例代碼來推送notifications.I可以通過它註冊,但是當我傳遞消息時,我沒有收到任何消息。 這是服務器代碼。我們可以PLZ解釋如何在gcm.I登記註冊了,但我也懷疑,是否有看到消息的任何方式接收信息在GCM如何使用oracle maf執行推送通知

所有的
<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> 
+0

將相關代碼添加到您的問題。 –

+0

您添加了一些ADF代碼,與推送和MAF有什麼關係? – User404

+0

農林部2.1.1擴展提供了兩個示例應用程序 - PushDemo,它演示瞭如何獲得在MAF應用推送通知,並PushServer,它演示瞭如何發送推送通知的應用MAF。上面的代碼是推送服務器代碼 – CodeWriter

回答

0

首先,你將有兩個應用程序。服務器應用程序(PushServer)和使用MAF框架(PushDemo)實現的移動應用程序。我相信在將MAF模塊安裝到JDeveloper中後,您會發現這些應用程序。其次,要註冊Google Cloud Messaging服務器,請轉至this link,編寫您的應用程序名稱(默認爲PushService)和Android包名稱(示例應用程序的默認值爲com.oraclecorp.internal.maf.PushSample)。你會得到一個GOOGLE API KEY,你將不得不設置成PushServer應用,到MessageBean類(它是一個不斷有所謂的GOOGLE_APIKEY)和senderId你會寫入到移動應用程序(爲adf- config.xml - 它是一個名爲gcmSenderId的屬性)。

你將不得不運行在公共服務器上的服務器項目(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過程,事情有點複雜,但教程讓你去。

感謝,
勒茲萬

+0

我已經試過上述步驟,現在仍然沒得到通知是沒有得到調用 – CodeWriter

+0

當我通過服務器發送消息時,onMesssage方法未被調用。可以請你幫忙 – CodeWriter

+0

@Janak你能發表/更新警告信息嗎?如果你已經解決了這個問題,你還可以更新嗎? –

0

以上實現JSSE所有託管服務器包括管理服務器後解決問題(在WebLogic服務器)。