Titanium Mobile tips to get weather forecast message

This is Titanium Mobile tips to get weather forecast message, which you can use to implement in your native iOS apps.

This tutorial required Imgshow Library for Titanium Mobile hosted on Github.

We require Titanium.Geolocation method to get our current latitude and longitude, and then pass this info to API, to get weather forecast message.

The sample code to get weather forecast message:

var fetchWeather = function(cb) {
	Titanium.Geolocation.purpose = "Get Weather";
	Titanium.Geolocation.getCurrentPosition(function(evt) {
		var lat = evt.coords.latitude;
		var lng = evt.coords.longitude;
		imgshow().name('weather').p('lat', lat).p('lng', lng).p('display', 'label').load(function(data) {
fetchWeather(function(message) {
  alert("Weather now is: " + message);

The sample response would be: Weather now is 28 C Mostly Cloudy at Jurong Town, Singapore.

Author: fyhao

Jebsen & Jessen Comms Singapore INTI University College Bsc (Hon) of Computer Science, Coventry University

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.