Home How to Synchronize a Network Update on N9 in QML

How to Synchronize a Network Update on N9 in QML

Nokia-Developer-Stock-Website
This article explains how to trigger a job, usually a network update, that is synchronized with other network activity.

Introduction

This short article gives an example of the AlignedTimer QML object from the Qt Mobility 1.2 API. This component allows the creation of a timer that will be triggered at the same time as other applications’ timers. This is useful to synchronize updates, for example to group network updates together (reduce power consumption on mobile devices).

Summary

The following code shows an example of AlignedTimer. This timer will be triggered between 15 and 30 minutes later, based on other applications’ use of AlignedTimers. The system will try to synchronize them as much as possible, to reduce the number of wake-ups, or number of times the network needs to be brought up.

import QtQuick 1.0
import com.nokia.meego 1.0
import QtMobility.systeminfo 1.2
 
PageStackWindow {
    id: window
[...]
    // Create the AlignedTimer
    AlignedTimer {
        id: alignedTimer
        // Set the timer to trigger between 15 and 30 minutes
        // Other applications using an AlignedTimer would be triggered
        //  during this same interval (for example mail sync) if possible
        maximumInterval: 30*60   // in seconds
        minimumInterval: 15*60    // in seconds
        singleShot: true  // Run it only once. Comment this line for a recurring timer
        onTimeout: {
            // Place update code, such as network sync here
        }
    }
 
    Component.onCompleted: {
        // Start the time once the PageStackWindow is created (application loaded)
        alignedTimer.start()
    }
[...]

 
 
Source Nokia Developer

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.