Skip to content

Instantly share code, notes, and snippets.

/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* Tested on 3.2.1 of TITANIUM MOBILE SDK, should work on 3.x. I don't know about previous versions.
*
* Based on https://gist.github.com/dawsontoth/832488
* which does not fire the activity callback on 3.x
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
// I was unhappy about there was close to no control over the "pageControl"
// in scrollableViews, so I hacked my own
// -----
// Configuration
var pageColor = "#c99ed5";
PagingControl = function(scrollableView){
var container = Titanium.UI.createView({
height: 60
@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>'
@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: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
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/
/**
* 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 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];
// ==============================================================================
// Create custom loading indicator
// ==============================================================================
var indWin = null;
var actWin = null;
var indicatorShowing = false;
var actInd;
var actIndAndroid;
var screenWidth = Titanium.Platform.displayCaps.platformWidth;
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' });