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
var win = Titanium.UI.currentWindow; | |
// the following example orientationModes values would reset the orientation modes to full sensor | |
win.orientationModes = []; | |
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
var win = Titanium.UI.currentWindow; | |
// the following example orientationModes values would set (and lock) orientation to landscape | |
win.orientationModes = [Ti.UI.LANDSCAPE_LEFT]; |
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
var win = Titanium.UI.currentWindow; | |
// the following example orientationModes values would set (and lock) orientation to portrait | |
win.orientationModes = [Ti.UI.PORTRAIT]; |
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
var win = Titanium.UI.currentWindow; | |
// the following example orientationModes values would set orientation to sensor landscape | |
win.orientationModes = [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]; |
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
var win = Titanium.UI.currentWindow; | |
// the following example orientationModes values would set orientation to sensor portrait | |
win.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT]; |
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
var win = Titanium.UI.currentWindow; | |
// the following example orientationModes values would set orientation to full sensor | |
win.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_RIGHT]; | |
win.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT] | |
win.orientationModes = [Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT]; |
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
//Create a socket and listen for incoming connections | |
var listenSocket = Ti.Network.Socket.createTCP({ | |
port: 40404, | |
accepted: function(e) { | |
// this where you would usually store the e.inbound value somewhere else so it can be used for | |
// read / write operations elsewhere in the app | |
Ti.API.info("Listening socket <" + e.socket + "> accepted incoming connection <" + e.inbound + ">"); | |
e.inbound.close(); // close the accepted socket | |
}, |
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
//Create a socket, connect to another listening socket locally, write some data and then enter read loop | |
var connectSocket = Ti.Network.Socket.createTCP({ | |
host: 'google.com', | |
port: 80, | |
connected: function(e) { | |
Ti.API.info("Socket <" + e.socket + "> connected to host <" + e.socket.host + ">"); | |
postConnect(); | |
}, | |
error: function(e) { | |
Ti.API.error("Socket <" + e.socket + "> encountered error when connecting"); |
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
//Create an empty TCP socket | |
var socket = Ti.Network.Socket.createTCP(); |
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
var headingAdded = false; | |
var locationAdded = false; | |
Ti.Geolocation.preferredProvider = "gps"; | |
var headingCallback = function(e) | |
{ | |
Ti.API.info("Received heading callback"); | |
} | |
Ti.Geolocation.addEventListener('heading', headingCallback); |