titaniumtitanium-sdk

what is the significance of setFrequency() function in titanium Js v7.5.0


I have been facing an issue regarding Geolocation in iOS/Android app. I am using Titanium Js and have upgraded Ti v7.5.0 to v8.3.1. I checked my legacy code and came to know that this below function

Titanium.Geolocation.setFrequency()

creating a problem. It seems like this function gets deprecated.

this.locationFrequency = 100;

Geolocate.prototype.getCurrentPosition = function(callback){
var self = this;

// initialize the callback
this.locationReceivedCallback = callback;

// Set this so we get updates rapidly
Titanium.Geolocation.setFrequency(this.locationFrequency)

// Register for the actual event
Titanium.Geolocation.addEventListener('location', someCallBackFunc);
};

Now, I need help to understand what actually this Titanium.Geolocation.setFrequency() does. Is there any alternate way to achieve the same in latest version of Ti?


Solution

  • Since it is open source you can look at the github repo: https://github.com/appcelerator/titanium_mobile/blob/7_5_X/android/modules/geolocation/src/java/ti/modules/titanium/geolocation/GeolocationModule.java#L469

    and check the official documentation at frequency https://docs.appcelerator.com/platform/latest/?print=/api/Titanium.Geolocation#property-frequency and use the recommendation there.