Created
October 25, 2013 04:50
-
-
Save ihsanberahim/7149561 to your computer and use it in GitHub Desktop.
email screenshot
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
/* | |
* For beta testing purposes create a camera button that can be set | |
* as the right nav button. Upon clicking create a screenshot and | |
* display the email dialog with pre-populated fields. | |
* This is a convenience for testers to send a screenshot straight | |
* out of the applicaiton. | |
*/ | |
function createScreenShotButton() { | |
var buttonObjects = [ | |
{image:'images/camera.png', width:45} | |
]; | |
var buttonBar = Titanium.UI.createButtonBar({ | |
labels:buttonObjects, | |
backgroundColor:'#000' | |
}); | |
var indicator = createIndicatorWindow(); | |
buttonBar.addEventListener('click', function(e) { | |
if (e.index === 0) { | |
Ti.Media.takeScreenshot(function(event) { | |
indicator.openIndicator(); | |
var emailDialog = Ti.UI.createEmailDialog() | |
emailDialog.subject = "Screenshot from myApp"; | |
emailDialog.toRecipients = ['my@email-address.com']; | |
emailDialog.messageBody = 'Describe the problem please'; | |
emailDialog.addAttachment(event.media); | |
emailDialog.open(); | |
indicator.closeIndicator(); | |
}); | |
} | |
}); | |
return buttonBar; | |
} | |
exports.createScreenShotButton = createScreenShotButton; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment