4 Replies Latest reply on Sep 6, 2013 4:10 AM by Kutir Mobility

    Why after dosync my mobile app directet to index.erb page?

    Alexey Mironov

      Why after dosync my mobile app directet to index.erb page?

       

        def login_callback

          SyncEngine.dosync()

        

      SyncEngine.logout

      redirect :action => :nextpage 

       

        end

       

        def Sync_

          SyncEngine.login("1", "1", (url_for :action => :login_callback) ) 

          render

        end

       

      I dont ned it. I want to direct to nextpage....

        • Re: Why after dosync my mobile app directet to index.erb page?
          Pietro Francesco Maggi

          Hi Alexey,

          that is the code generated for a generic application. Is what makes sense for a generic application.

           

          But this is part of your application and you can tailor/change as it better fits to your need. This is even the main beauty of the Rhodes/RhoElements framework: the flexibility.

           

          Other things that you may want to change is in the Settings controller for:

          • What happens when a sync is complete, default is to go to start page
          • What happens when there's an error during sync, on create error, default for v2.2SP1 is to delete the record, to avoid that invalid records freeze the sync process.
          • What happens during sync, want to show a spinning wheel or a progress bar? again in the sync_notify action in the Settings controller, there're the hooks to do this.

           

          and so on.

          If there's something that doesn't fit with your design, you can change it!

           

          In your case, you want probably to change what happens in the sync_notify action in the Settings controller.

           

          Best regards

          Pietro

          • Re: Why after dosync my mobile app directet to index.erb page?
            Kutir Mobility

            Alexey, here are some other pointers you may find useful:

             

            • in app/application.rb you will see that sync engine notifications are being sent to /app/Settings/sync_notify. You can change that to point to your own controller if you want, or modify the sync_notify action in the Settings controller to do what you need
            • it is not necessary to logout after synchronizing (unless you have a good reason to do so). Also, when dosync() returns the sync process will not be complete yet because synchronization is a background process, if you logout immediately after dosync(), it is likely that synchronization will never complete successfully.
            • redirect does not work in callbacks, you must use WebView.navigate instead

             

            Javier

            Kutir Mobility