Created
February 29, 2016 15:36
-
-
Save boarnoah/2e4a0970610b3cd46f1a to your computer and use it in GitHub Desktop.
TIMOB-20220
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
//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