Skip to content

Instantly share code, notes, and snippets.

@AppWerft
Created November 5, 2016 18:00
Show Gist options
  • Save AppWerft/3ae7a2e8aaa8c14208f68a7d88f5c352 to your computer and use it in GitHub Desktop.
Save AppWerft/3ae7a2e8aaa8c14208f68a7d88f5c352 to your computer and use it in GitHub Desktop.
Ti.Media.createSound({
url : "Silent.wav",
looping : true
}).play();
Ti.Geolocation.trackSignificantLocationChange=true;
Ti.Geolocation.pauseLocationUpdateAutomatically = true;
Ti.Geolocation.addEventListener("location", function() {
});
var i = 0;
setInterval(function() {
i++;
if (i > 1 && i % 60 == 0) {
Ti.App.iOS.scheduleLocalNotification({
alertBody : 'Run time ' + i + ' min.',
date : new Date(new Date().getTime() + 30000)
});
}
console.log("dirtyTrick 🏁: " + i);
}, 1000);
/* or 'notification' */
Ti.App.currentService.addEventListener('stop', function() {
Ti.App.iOS.scheduleLocalNotification({
alertBody : 'currentService stopped',
date : new Date()
});
});
Ti.Network.addEventListener("change", function(e) {
console.log("dirtyTrick 🏁 network changed");
Ti.App.iOS.scheduleLocalNotification({
alertBody : 'Online=' + e.online + " after " + i + " sec.",
date : new Date()
});
});
Ti.App.iOS.scheduleLocalNotification({
alertBody : 'Background service started',
date : new Date(new Date().getTime() + 5000)
});
console.log("dirtyTrick 🏁 started");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment