Janaki Narayanan
Janaki Narayanan

Reputation: 543

How to implement push notification using oracle maf

I just tried the the sample code provided by oracle maf for push notifications.I can register through it but when I pass message I didn't receive any message. this is server code. Can us plz explain how to register in gcm.I registered there but I doubt in that also and is there any way to seeing the message received details in 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>

Upvotes: 0

Views: 672

Answers (2)

Janaki Narayanan
Janaki Narayanan

Reputation: 543

Above issue solved after enabling JSSE on all managed servers including Admin Server (in weblogic server).

Upvotes: 0

Razvan N
Razvan N

Reputation: 654

First of all, you will have two applications. A server application (PushServer ) and a mobile application implemented with MAF framework (PushDemo) .I believe you found those after you installed MAF module into JDeveloper.

Secondly, to register with Google Cloud Messaging server, go to this link , write your app name ( default is PushService ) and your Android package name ( default for sample app is com.oraclecorp.internal.maf.PushSample ). You will get a GOOGLE API KEY which you will have to set into the PushServer application, into the MessageBean class (it is a constant there called GOOGLE_APIKEY), and a senderId that you will write into the mobile application ( into adf-config.xml - it is a property called gcmSenderId ).

You will have to run the server project on a public server ( Weblogic probably ) and have your mobile app call the URL where your servlet is - for example : http://www.something.com/PushService-ViewController-context-root/registrations ), then in your mobile application project, under connections.xml you have two fields that you have to edit :

<urlconnection name="SyncService_base_connection" url="http://www.something.com"/>

and

 <urlconnection name="PushServiceConn" url="http://www.something.com/PushService-ViewController-context-root/registrations"/>

You start the app on the device, then check on the application if you registered into the database. Then if you press push for your device, you should receive those notifications straight on the Android device.

For the APNS process things are a little bit complicated, but the tutorial gets you going.

Thanks,
Razvan

Upvotes: 0

Related Questions