GithubHelp home page GithubHelp logo

srescio / clipboardmanagerplugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jacob/clipboardmanagerplugin

0.0 1.0 0.0 114 KB

Phonegap Android plugin for interacting with Android ClipbaordManager

License: Other

Java 78.06% JavaScript 21.94%

clipboardmanagerplugin's Introduction

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.

clipboardmanagerplugin's People

Contributors

srescio avatar jacob avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.