Skip to content

Instantly share code, notes, and snippets.

@boarnoah
Created February 29, 2016 15:36
Show Gist options
  • Save boarnoah/2e4a0970610b3cd46f1a to your computer and use it in GitHub Desktop.
Save boarnoah/2e4a0970610b3cd46f1a to your computer and use it in GitHub Desktop.
TIMOB-20220
//index.js:
Ti.API.info("Creating activity...");
var activity = Ti.App.iOS.createUserActivity({
activityType:'com.foo.message',
title:'Handoff Messenger',
userInfo:{
msg: 'Tag! You\'re it!'
}
});
if(!activity.isSupported()){
alert('activity is not supported');
} else {
Ti.API.info("Activity is supported...");
activity.becomeCurrent();
}
activity.addEventListener('useractivitywascontinued', function(e) {
Ti.API.info('Activity moved to a different device.');
});
Ti.App.iOS.addEventListener('continueactivity', function(e){
Ti.API.info("continueactivity was fired");
if (e.activityType === 'com.foo.message' && e.userInfo.msg) {
alert(e.userInfo.msg);
}
});
$.index.open();
//tiapp.xml:
/*
<ios>
<plist>
<dict>
<key>NSUserActivityTypes</key>
<array>
<string>com.foo.message</string>
<string>com.foo.bar</string>
</array>
</dict>
</plist>
</ios>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment