Topic
  • 5 replies
  • Latest Post - ‏2012-02-13T16:46:11Z by JianGao
JianGao
JianGao
4 Posts

Pinned topic Question on Sample of Notified Mysurance Sample for Android

‏2012-01-17T18:46:40Z |
I downloaded and tried all samples shipped from the latest preview tools of IBM Mobile.
After setup mysurance server and started up mobilemgmt server. I am able to run application of Mysurance Sample for Android with my local server in Android simulator successfully.
My question is when I try application of Notified Mysurance Sample for Android, application always return errors - Error!CONNECTION_ERR whenever I try to update server info or registration by my local mysurance server and mobilemgmt server urls.

During debugging, I find in appmgmt.js, there might be a typo in following code snippet - should "getRegisrationInfo" be "getRegistrationInfo"?

com.ibm.mobile.ApplicationManagement.prototype.getRegistrationInfo = function(successCallback, errorCallback) {
// Get info
return PhoneGap.exec(successCallback,
errorCallback,
"com.ibm.mobile.ApplicationManagementPlugin",
"getRegisrationInfo",
[]);
};

Thanks!
Updated on 2012-02-13T16:46:11Z at 2012-02-13T16:46:11Z by JianGao
  • MingZheHuang
    MingZheHuang
    1 Post

    Re: Question on Sample of Notified Mysurance Sample for Android

    ‏2012-01-20T08:28:39Z  
    This typo seems not related to this error.
    I guess you've typed in the same URL as original mysurance, right?
    Actually the URL for notified mysurance is slightly different. You'll have to input the URL of the IMP server instead of the URL of the mysurance application.

    For example, suppose URL of mysurance application is "http://192.168.0.1:9080/mysurance". Try to type in "http://192.168.0.1:9080" (without application context) for notified mysurance.
  • Drago
    Drago
    2 Posts

    Re: Question on Sample of Notified Mysurance Sample for Android

    ‏2012-01-20T14:57:40Z  
    Hi folks, following your instruction I'm able to "update address" but not to receive notification on the emulator.

    Any Idea ?

    P.S. I'm running on linux (ubuntu) and the previous version of the application worked.

    Thanks in advance for your help.

    Marco
  • NiliGuy
    NiliGuy
    2 Posts

    Re: Question on Sample of Notified Mysurance Sample for Android

    ‏2012-01-22T12:14:30Z  
    • Drago
    • ‏2012-01-20T14:57:40Z
    Hi folks, following your instruction I'm able to "update address" but not to receive notification on the emulator.

    Any Idea ?

    P.S. I'm running on linux (ubuntu) and the previous version of the application worked.

    Thanks in advance for your help.

    Marco
    Hey,

    How are you trying to send notification to the application? You might not be using the correct device ID.
    To find the correct device ID go to
    http://localhost:9080/mobilemgmt/view/desktop/pages/devices
    (or change localhost to your IP and port), you should see there TWO devices (the reason for that is that IBM Mobile Enabler also registers the device, and all the applications that were installed though it implicitly, the notified mysurance application also registers the device and application for itself, in the future there will be only one device ID). The device ID you are looking for is the one which was done later in time and in installed applications only contains the notified mysurance.

    To send the notification you should run the following command with your device ID
    curl -v -H "Content-Type: application/json" -X POST
    -d '{"appID":"com.ibm.sample_notifiedmysurance_android.mysurance", "deviceID":"1ccb151e6055828e", "message":"Hi", "payload": {"alert":"Wow"}}'
    http://<server>:<port>/notifications/trigger/notifications/
  • Drago
    Drago
    2 Posts

    Re: Question on Sample of Notified Mysurance Sample for Android

    ‏2012-01-26T09:42:30Z  
    • NiliGuy
    • ‏2012-01-22T12:14:30Z
    Hey,

    How are you trying to send notification to the application? You might not be using the correct device ID.
    To find the correct device ID go to
    http://localhost:9080/mobilemgmt/view/desktop/pages/devices
    (or change localhost to your IP and port), you should see there TWO devices (the reason for that is that IBM Mobile Enabler also registers the device, and all the applications that were installed though it implicitly, the notified mysurance application also registers the device and application for itself, in the future there will be only one device ID). The device ID you are looking for is the one which was done later in time and in installed applications only contains the notified mysurance.

    To send the notification you should run the following command with your device ID
    curl -v -H "Content-Type: application/json" -X POST
    -d '{"appID":"com.ibm.sample_notifiedmysurance_android.mysurance", "deviceID":"1ccb151e6055828e", "message":"Hi", "payload": {"alert":"Wow"}}'
    http://<server>:<port>/notifications/trigger/notifications/
    Hi NiliGuy, thank you very much for your suggestion. Now it is working.

    Marco
  • JianGao
    JianGao
    4 Posts

    Re: Question on Sample of Notified Mysurance Sample for Android

    ‏2012-02-13T16:46:11Z  
    Hi folks, thank you very much for prompt answer!
    Just came back from a long vacation and could not follow up the thread on time.
    Currently our team is evaluating another mobile app framework.
    And I will definitely give another try as your instruction once I get chance.