Created
November 5, 2016 18:00
-
-
Save AppWerft/3ae7a2e8aaa8c14208f68a7d88f5c352 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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