Skip to content

Instantly share code, notes, and snippets.

@jmsalcido
Created March 2, 2013 23:19
Show Gist options
  • Save jmsalcido/5073714 to your computer and use it in GitHub Desktop.
Save jmsalcido/5073714 to your computer and use it in GitHub Desktop.
Computo Movil Proyecto 1 - jmsalcido
// Proyecto 1 de Computo Movil
// Script para el proyecto 1 de Computo Movil.
// Triggers the function when the screen unlocks
device.screen.on("unlock", function(){
feeds.weather.get(
{location: 'Ciudad Obregon',
locationtype: 'city',
unittype: 'm'
},
function onSucess(weather, textStatus, response) {
var temperatura = weather.now.temperature;
if(temperatura > 30) {
var msg = device.notifications.createMessageBox("Que Calor!!!");
msg.content = "Wey, esta haciendo un chango de calor. Estamos a mas de 30 grados.";
msg.buttons = [":("];
msg.show();
}
console.log("Weather for " + weather.location + "is: " + weather.now.temperature);
},
function onError(response, textStatus) {
console.error("Weather error from script");
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment