-
-
Save de1mat/e0d8c1940173d42905597f9a70a36a23 to your computer and use it in GitHub Desktop.
Appcelerator Titanium - Share data with other apps #appcelerator #titanium #hyperloop
This file contains hidden or 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