Skip to content

Instantly share code, notes, and snippets.

@Max87ZA
Forked from m1ga/hyperloop.js
Created March 21, 2023 14:53
Show Gist options
  • Save Max87ZA/15c53a7063d522263d9a54911851a56d to your computer and use it in GitHub Desktop.
Save Max87ZA/15c53a7063d522263d9a54911851a56d to your computer and use it in GitHub Desktop.
Appcelerator Titanium - Share data with other apps #appcelerator #titanium #hyperloop
// 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