Skip to content

Instantly share code, notes, and snippets.

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>YOUR APPLICATION ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR APP NAME</string>
</array>
</dict>
function handle_attachments() {
// make sure we have new args before firing
// prevents handling of the same file every time the app opens, resumes, etc
args = Ti.App.getArguments();
var file = args.url;
var source = args.source;
// make sure we have something to work with
if(!file) {
return false;
var win = Titanium.UI.createWindow({
title: 'Video Record',
backgroundColor: '#fff'
});
var videoUri = null;
function startRecording(){
var intent = Titanium.Android.createIntent({ action: 'android.media.action.VIDEO_CAPTURE' });
// ==============================================================================
// Create custom loading indicator
// ==============================================================================
var indWin = null;
var actWin = null;
var indicatorShowing = false;
var actInd;
var actIndAndroid;
var screenWidth = Titanium.Platform.displayCaps.platformWidth;
// this file located in /Library/Application Support/Titanium/mobilesdk/osx/{version_number}
// add the following methods to GeolocationModule.mm
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMBOOL(YES),@"success",[NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(region.center.latitude),@"lat",NUMDOUBLE(region.center.longitude),@"lng",NUMDOUBLE(region.radius),@"radius",region.identifier,@"identifier",nil],@"region",nil];
if ([self _hasListeners:@"enteredRegion"])
{
[self fireEvent:@"enteredRegion" withObject:event];
/**
* We'll start by making a window with a button...
*/
var win = Ti.UI.createWindow({
backgroundColor : '#fff'
});
var shareButton = Ti.UI.createButton({
width : 90,
bottom : 10,
height : 30,
This gist is only for Android.
If you would like launch native apps
on iPhone, iPad, you can find information about it in Appcelerator Docs:
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.canOpenURL-method.html
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.openURL-method.html
More info about iOS URL Schemes: http://handleopenurl.com/
@mitulbhalia
mitulbhalia / app.js
Last active August 29, 2015 14:12 — forked from Rogichi/app.js
// How Publish a Tweet (Titanium)
// Full Codebird API is here: https://github.com/mynetx/codebird-js
// Codebird for Appcelerator Titanium. Using the Twitter API 1.1: https://gist.github.com/viezel/5781083
//THANKS VIEZEL
@mitulbhalia
mitulbhalia / app.js
Last active August 29, 2015 14:12 — forked from viezel/app.js
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
@mitulbhalia
mitulbhalia / app.js
Last active August 29, 2015 14:13 — forked from zeuxisoo/app.js
Ti.include('lib/htmlparser.js');
Ti.include('lib/soupselect.js');
var select = soupselect.select;
var body = '<html><head><title>Test</title></head>'
+ '<body>'
+ '<img src="http://l.yimg.com/mq/i/home/HKGallery.gif" />'
+ '<div id="block">'
+ ' <div class="row">Row 1</div>'