Time for action – sending a screenshot to Facebook
Perform the following steps to send a screenshot to Facebook:
Create a new blank mobile app by selecting File | New | Titanium Project. Don't use a template as it will just generate code that gets in the way.
Create the window for the app:
var win1 = Titanium.UI.createWindow({ backgroundColor:'#fff' });
Add something to the screen so the screenshot is not just a blank canvas! For this example we will be re-using the code from an earlier section of this book by adding random green blocks to the window. This step is not important for the example; it just adds something to the screen.
var height = Ti.Platform.displayCaps.platformHeight, width = Ti.Platform.displayCaps.platformWidth; // add some random boxes on the screen for (var i=0; i<5; i++) { var randomPosView = Ti.UI.createView({ width:'10%', height:'10%', backgroundColor:'green', borderColor:'black', left: Math.random() * width, top:Math.random() * height }); ...