Created
September 22, 2011 00:05
-
-
Save jonalter/1233686 to your computer and use it in GitHub Desktop.
iOS: disable snapshot from being taken when app backgrounded (for security reasons)
This file contains 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
// by Blain Hamon | |
var win = Ti.UI.createWindow({ | |
backgroundColor : 'white', | |
orientationModes : [Ti.UI.PORTRAIT] | |
}); | |
win.open(); | |
var label = Ti.UI.createLabel({ | |
text : 'No app event received. Make call while running app', | |
textAlign : 'center', | |
width : 'auto' | |
}); | |
win.add(label); | |
Titanium.App.addEventListener('pause', function() { | |
// this will delete the Snapshots folder and create a file in its place | |
// so that the folder cannot be recreated | |
var snapFolder = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory,"../Caches/Snapshots"); | |
snapFolder.deleteDirectory(true); | |
snapFolder.write("No Folder for you!"); | |
label.text = "App has been paused"; | |
}); | |
Titanium.App.addEventListener('resume', function(e) { | |
label.text = "App has resumed"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment