How to run Background thread in ionic?

var myVar = setInterval(alertFunc, 60000);

    function alertFunc() {
        console.log('int')
        var latitude,longitude;
        navigator.geolocation.getCurrentPosition(function(position) {
            latitude = position.coords.latitude;
            longitude = position.coords.longitude;
            console.log(latitude);
            console.log(longitude);


        }, function(error) {
            alert('Unable to get location: ' + error.message);
        });
}

I am using this code inside my controller

Hi I am new in ionic I am now using background geolocation plugin while using that I am getting a warning "['Geolocation'] took '13.754150' ms. Plugin should use a background thread" how to run background thread in ionic? Thanks in advance.

Ignore that error, that comes up every time you load a plugin. And if you want to use BackgroundGeolocation. there is a plugin for it available at ngCordova.