2 Replies Latest reply on Jan 5, 2016 10:49 AM by nicolas lasso

    Issues with Rho.Notification.showPopup

    nicolas lasso

      Hello!

       

      We're facing some bugs regarding the behavior of Rho.Notification.showPopup method. The method itself is working properly. The dialog is appearing properly in the middle of the screen with the buttons and everything but when the app is running in background and a notification appears, it does like a push notification which I understand it's the proper behavior but when coming back to the app all the following popups are appearing like a push notification instead of a dialog in the middle of the screen. Please keep in mind the following steps to reproduce this behavior:

      • Open the app.
      • Leave it running in background (e.g, switch to another application)
      • Wait until a push notification from the initial app appears.
      • Return to the app.
      • Wait until another notification appears (it will appear as a push notification even having the app running in the front). It should appear like a dialog but it's a push notification.

      Please, let us know if any more clarification is needed or a call or anything and how to fix it in case is a known bug.

       

      OS: Android 4.3.3 or higher.

      Hardware: Moto G 2nd Gen, Motorola Symbol TC55.

      Rho Version: 5.2.2

       

      This is the code that opens the notification:

      function showAlert (titleParam, messageParam) {

          Rho.Notification.showPopup({

              title: titleParam,

              message: messageParam,

              buttons: [{id:'ok', title:'Ok'}]

          }, function(e){

              if(e.button_id == "ok"){

                  Rho.Notification.hidePopup();

              }

          });

      }

       

      Thanks!!!

       

      Happy new year!

       

      Nicolás

        • Re: Issues with Rho.Notification.showPopup
          BHAKTA RANJAN SATAPATHY

          Hello Nicolas,

           

          Kindly set the types attribute.

           

          types : Array

          List which notification kinds will be shown. Several types may be listed at same time. ‘TYPE_NOTIFICATION’ and ‘TYPE_NOTIFICATION_DIALOG’ take no effect if application is in the foreground. By default ‘[Rho.Notification.TYPE_DIALOG, Rho.Notification.TYPE_NOTIFICATION]’ is used. Example:

           

           

          typeToast = [Rho.Notification.TYPE_DIALOG, Rho.Notification.TYPE_TOAST];

          Possible Values :

           

           

          Constant: Rho::Notification.TYPE_DIALOG (For Ruby use "::" for all "." when referencing constants)

          String:dialog

          Show common dialog window with buttons visible if application is active.

           

           

          Constant: Rho::Notification.TYPE_NOTIFICATION (For Ruby use "::" for all "." when referencing constants)

          String:notification

          Show message in Android notification bar if application is at background. Touch the message opens the application.

           

           

          Constant: Rho::Notification.TYPE_NOTIFICATION_DIALOG (For Ruby use "::" for all "." when referencing constants)

          String:notificationDialog

          This is the same as ‘TYPE_DIALOG’ + ‘TYPE_NOTIFICATION’.

           

           

          Constant: Rho::Notification.TYPE_TOAST (For Ruby use "::" for all "." when referencing constants)

          String:toast

          Show toast window with message at foreground for a short time. The toast is visible nevertheless the application is at background or foreground but is not shown same time with any foreground pop-up.

           

          Find the docs at Rhomobile | Notification

           

          Code Snippet:

          Rho::Notification.showPopup({

              :title =>"Displaying a pop up",

              :message => "Displaying a Normal Popup",

              :icon => "info",

              :buttons => [{:id => 'accept', :title => 'ok'}],

              :types => [Rho::Notification::TYPE_DIALOG]},url_for(:action => :popup_callback)

          );

           

          Thanks

          1 of 1 people found this helpful