Skip to content
var qxCore = {
callbackWrappers : {
wrapperCounter : 0,
generateId : function(name){
qxCore.callbackWrappers.wrapperCounter++;
return name + qxCore.callbackWrappers.wrapperCounter;
}
}
};
'use strict';
import View from 'view';
import Window from 'window';
// Example Usage
let win = new Window();
let view = new View({
top: 0,
var win = Titanium.UI.createWindow({
backgroundColor:'grey'
});
Ti.Geolocation.preferredProvider = "gps";
Ti.Geolocation.purpose = "GPS demo";
Ti.Geolocation.trackSignificantLocationChange = true;
Ti.Geolocation.setAllowBackgroundLocationUpdates(true);
var activity = Titanium.App.iOS.createUserActivity({
activityType : "com.appcelerator.handoff.example.browsing-location"
userInfo : someDictionary,
needsSave : false,
webpageUrl : "optional webpage",
title : "an example"
});
activity.addEventListener("useractivitywascontinued",function(e){
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
{
NSMutableDictionary *dict = [NSMutableDictionary
dictionaryWithObjectsAndKeys:[userActivity activityType],@"activityType",
nil];
if([userActivity title] !=nil){
[dict setObject:[userActivity title] forKey:@"title"];
}
var btnAction = Ti.UI.createButton({
title:"I'm a button",
backgroundColor:"#e7e7e8",
width:85, height:55, bottom:0, borderColor:"#999"
});
$.tbgroup.add(btnAction);
$.tbgroup.open();

This pull request adds support for a Apple Watch Extension to be able to openParentApplication and have a Titanium application reply.

This pull request is related to the Jira ticket TIMOB-18854.

This pull request consists of a few different parts.

1.Application Delegate

This pull request adds a delegate method to Tiapp.m this delegate raises the Ti.App.iOS watchkitextensionrequest event. The userInfo provided by the extension openParentApplication is passed through to the watchkitextensionrequest event. The reply method of the delegate is captured and placed into an NSDictionary. This allows for the reply message to later be called as part of the sendWatchExtensionReply method.

This gist outlines how to use an experimental build of the Ti SDK that includes the delegate needed for openParentApplication support

Steps:

  1. Download the latest master nightly build
  2. You need to replace the following four files in your nightly build with the ones listed below

https://github.com/benbahrenburg/titanium_mobile/blob/ca8083c3a99fd017a6656f33f2c99e0d7118c65c/iphone/Classes/TiApp.h https://github.com/benbahrenburg/titanium_mobile/blob/ca8083c3a99fd017a6656f33f2c99e0d7118c65c/iphone/Classes/TiApp.m https://github.com/benbahrenburg/titanium_mobile/blob/ca8083c3a99fd017a6656f33f2c99e0d7118c65c/iphone/Classes/TiAppiOSProxy.m

var dir = Ti.Filesystem.getApplicationSupportDirectory();
console.log(dir);
var f = Titanium.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory);
console.log('Directory Exists: '+ (f.exists() ? 'Yes' : 'No'));
console.log('Needs to be yes to pass'));
var testfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, 'text.txt');
if(testfile.exists()){
testfile.deleteFile();
}
//To test the method use the following
var dir = Ti.Filesystem.getApplicationSupportDirectory();
console.log(dir);
var f = Titanium.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory);
console.log('Directory Exists: '+ (f.exists() ? 'Yes' : 'No'));
var testfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, 'text.txt');
if(testfile.exists()){
testfile.deleteFile();
Something went wrong with that request. Please try again.