Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created September 22, 2011 00:05
Show Gist options
  • Save jonalter/1233686 to your computer and use it in GitHub Desktop.
Save jonalter/1233686 to your computer and use it in GitHub Desktop.
iOS: disable snapshot from being taken when app backgrounded (for security reasons)
// 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