-
-
Save Max87ZA/15c53a7063d522263d9a54911851a56d to your computer and use it in GitHub Desktop.
Appcelerator Titanium - Share data with other apps #appcelerator #titanium #hyperloop
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
// share items e.g. String with other apps | |
if (OS_IOS) { | |
// | |
// Hyperloop for iOS | |
// | |
var UIActivityView = require('UIKit/UIActivityViewController') | |
var TiApp = require('Titanium/TiApp'); | |
var uiv = UIActivityView.alloc().initWithActivityItemsApplicationActivities(["www.google.com"],null); | |
TiApp.app().showModalController(uiv, true); | |
} else { | |
// | |
// Intent for Android | |
// | |
var intent = Ti.Android.createIntent({ | |
action : Ti.Android.ACTION_SEND, | |
type : "text/plain" | |
}); | |
intent.putExtra(Ti.Android.EXTRA_TEXT, "www.google.com"); | |
intent.addCategory(Ti.Android.CATEGORY_DEFAULT); | |
try { | |
Ti.Android.currentActivity.startActivity(intent); | |
} catch (ex) { | |
console.log("Error") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment