Skip to content

Phonegap Android plugin for interacting with Android ClipbaordManager

License

Notifications You must be signed in to change notification settings

srescio/ClipboardManagerPlugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClipboardManager plugin for Phonegap

By Omer Saatcioglu

Enhanced by Guillaume Charhon

Ported to Phonegap 2.0 by Jacob Robbins

Ported to Phonegap 3.0 by Simone Rescio

This plugin gives access to Copy & Paste methods of the Android ClipboardManager. This version of the plugin is for Phonegap versions >= 3.0.0

Adding the Plugin to your project

  1. using terminal cd to your poroject dir and type : phonegap local plugin add https://github.com/srescio/ClipboardManagerPlugin.git
  2. using NetBeans, in nbproject/plugins.properties add : org.apache.cordova.clipboardmanager=https://github.com/srescio/ClipboardManagerPlugin.git

Using the plugin

The plugin creates 2 methods, copy and past, in the global clipboardManager

clipboardManager.copy(str, success, fail) that copies the given string into the clipboard clipboardManager.paste(success, fail) that returns the text from the clipboard

success and fail are callback functions.

An example for copy:

clipboardManager.copy(
	"the text to copy",
	function(r){alert("copy is successful")},
	function(e){alert(e)}
);

An example for paste:

clipboardManager.paste(
	function(r){alert("The text in the clipboard is " + r)},
	function(e){alert(e)}
);

Plugin developer notes

The name of the Java class was changed to ClipboardManagerPlugin because ClipboardManager is the name of the Android class this plugin interacts with. Duplicating the name of an existing class causes a name collision error. http://developer.android.com/reference/android/content/ClipboardManager.html

The plugin reference in the plugins.xml file must specifiy the location of the class of the plugin, not the file. That's why ClipboardManagerPlugin is repeated twice, once for the file and once for the name of the class.

About

Phonegap Android plugin for interacting with Android ClipbaordManager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 78.1%
  • JavaScript 21.9%