How to update rules in client

Pedro's Avatar

Pedro

12 Sep, 2016 08:21 AM

Hello,

Im working on an application wich includes Ubudu, everything seems to be working right, however Im finding myself a little lost while looking for some way to update rules on client app after they have been updated in server web-platform.

I just dont find any method to handle this.

Is it possible, or am I missing something?

Thank you in advance!

  1. Support Staff 1 Posted by francois on 12 Sep, 2016 08:28 AM

    francois's Avatar

    Hi Pedro,

    The SDK updates by default the rules every 2 hours by polling. This is configurable through the API and you can also manually trigger an update. Michal will provide the methods
    If you want during your development to quickly update the rules just quit the app and relaunch it. It will fetch the rules.
    You can see in the manager in the the loop the latest requests from your client (including the number of rules that have been returned).
    I hope this helps,

    François

  2. 2 Posted by Pedro on 12 Sep, 2016 08:56 AM

    Pedro's Avatar

    Hi Francois,

    I think automatic update will be good enough. Anyway I would like to know how to manually trigger that update, like you say.

    Thank you

  3. 3 Posted by Michal Gasztold on 12 Sep, 2016 10:10 AM

    Michal Gasztold's Avatar

    Hello,

    If you work with Android SDK please use the following methods on the com.ubudu.sdk.UbuduSDK instance to manage rules updates:

         * The next time we may normally fetch the areas from the ubudu API server.
         *
         * @return next fetching time
         */
        public Date nextFetchTime() {
            return implementationInstance.nextFetchTime();
        }
    
        /**
         * Set the next time we may normally fetch the areas from the ubudu API server.
         *
         * @param time next fetching time
         */
        public void setNextFetchTime(Date time) {
            implementationInstance.setNextFetchTime(time);
        }
    
    
        /**
         * @return period between fetching rules in seconds (default: 3600s)
         */
        public int fetchPeriodSeconds() {
            return implementationInstance.fetchPeriodSeconds();
        }
    
        /**
         * Set period between fetching rules in seconds
         *
         * @param aPeriod period in seconds
         */
        public void setFetchPeriodSeconds(int aPeriod) {
            implementationInstance.setFetchPeriodSeconds(aPeriod);
        }
    
        /**
         * method to force fetch areas
         */
        public void fetchAreas() {
            implementationInstance.fetchAreas();
        }```
    
  4. 4 Posted by Pedro on 12 Sep, 2016 12:12 PM

    Pedro's Avatar

    Thank you Michal, it works like a charm

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac