[TIMOB-1799] Android: Add API Support for Clipboard

GitHub Issuen/a
TypeNew Feature
Resolution Date2011-04-17T01:57:12.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
Labelsandroid, feature
ReporterDon Thorp
AssigneeDon Thorp


See ticket #648 Creating an android specific ticket for better tracking.

Feature from Brion

Spent a little weekend hacking time and threw together a quick port of the Titanium.UI.Clipboard module interface from Desktop:
http://github.com/brion/titanium_mobile/tree/clipboard">http://github.com/brion/titanium_mobile/tree/clipboard API docs, KitchenSink demo, Android, and iOS implementations are on that branch in separate commits.
The Android clipboard is limited to plaintext, which appears to work nice enough in my initial testing.
On iOS, in addition to text, there is theoretical support for URLs (marked as 'URL' or 'text/uri-list' as per Desktop, and using strings on our side) and images (as 'image' or actual MIME type). I haven't actually tested these code paths yet. :) Other data types may or may not be properly converted by the system libraries from the MIME type to the native clipboard UTI, and will also expect data in blob form.


  1. Don Thorp 2011-04-15

    Note: There is an example in KS at the end of the platforms tab.

  2. Jeff Haynie 2011-04-15

    (from [1cb0d8d9924777ca851e3192e395dc975f23a7fd]) [#1799 state:fixed-in-qa] Initial Ti.UI.Clipboard module for Android, following the Ti.UI.Clipboard API from Titanium Desktop.

    Since the Android clipboard only appears to support plain text strings, only text is supported. The getData(), setData(), and hasData() functions will pass text through if given 'text/plain', and otherwise do nothing.
    http://github.com/appcelerator/titanium_mobile/commit/1cb0d8d9924777ca851e3192e395dc975f23a7fd"> http://github.com/appcelerator/titanium_mobile/commit/1cb0d8d992477...

  3. Thomas Huelbert 2011-04-15 g1 1.6, 2.2 sim. new record for iOS parity

JSON Source