Code Monkey home page Code Monkey logo

Comments (22)

bau720123 avatar bau720123 commented on August 11, 2024 1

well~
I finally find a way to solve my problem in phonegap build 3.1

is to use...window,not cordova

window.plugins.clipboard.copy(text);
window.plugins.clipboard.paste(function (text) { alert(text); });

from cordovaclipboard.

gouravkakkar avatar gouravkakkar commented on August 11, 2024

From phonegap build 3.1.0 , you dont need to write-

$.getScript("js/plugins/com.verso.cordova.clipboard/www/clipboard.js");

Use the code in the following way -

var text="Sample Text";
cordova.plugins.clipboard.copy(text);

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

when I just use
http://www.littlebau.com/copy.html
but nothing happened too

from cordovaclipboard.

gouravkakkar avatar gouravkakkar commented on August 11, 2024

Make sure the plugin has been properly configured in your project.You can confirm this by checking in the YourProject/res/xml/config.xml , the plugin should be registered in this way:

<feature name="Clipboard">
        <param name="android-package" value="com.verso.cordova.clipboard.Clipboard" />
   </feature>

Or by running this command from CLI interface:

$ phonegap local plugin list

If properly configured, the plugin should be listed there.

From Phonegap 3.1.0, you dont need to import any specific js files of plugins. Just register them by CLI Interface.

from cordovaclipboard.

ctrevisan avatar ctrevisan commented on August 11, 2024

As @gouravkakkar pointed out, it seems that the plugin hasn't been installed properly. You should try reinstalling it.

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

OK
I will try later,really thanks

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

I tried many many times,it still not work by "phonegap build" 3.1

in phonegap build just like that way
https://build.phonegap.com/plugins/67

is it real work by "phonegap build"?

PS,I am very sure that the Clipboard plugin has been install
http://www.littlebau.com/clipboard.jpg

from cordovaclipboard.

jprichardson avatar jprichardson commented on August 11, 2024

Using Phonegap 3.1 in iOS 7, it works just fine for me.

Example:

cordova.plugins.clipboard.copy('some text');

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

thanks for jprichardson reply
did you use "phonegap build" 3.1 or just phonegap 3.1(Eclipse or xcode) ?

from cordovaclipboard.

jprichardson avatar jprichardson commented on August 11, 2024

phonegap build ios

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

ok
Could you help me to check out your cordova_plugins.js
There are some code written by...
http://www.littlebau.com/abc.html

is it as same as yours?

from cordovaclipboard.

ctrevisan avatar ctrevisan commented on August 11, 2024

Are you building locally or remotely with PhoneGap Build, and for what platform?

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

remotely

Android,4.03,HTC Sensationa XL
iOS,7.0.4,iPad mini

I will try in locally building
If I have any problem then ask your again,tks~

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

I just test the Android 4.1.1 and iOS 7.0.4

this is my "local" index.html code,and I am very sure that my phonegap.js is loaded success
and the plugin is install success too
http://www.littlebau.com/local.gif

<script src="phonegap.js" type="text/javascript"></script>
<script type="text/javascript">
function local1()
{
var text = "Hello World!";
window.plugins.copy(text);
window.plugins.paste(function (text) { alert(text); });
}

function local2()
{
var text = "Hello World!";
cordova.plugins.copy(text);
cordova.plugins.paste(function (text) { alert(text); });
}

function local3()
{
cordova.plugins.copy('Hello World!');
cordova.plugins.paste(function (text) { alert(text); });
}
</script>

<body>
<a onClick="local1();">local1</a></br></br>
<a onClick="local2();">local2</a></br></br>
<a onClick="local3();">local3</a></br></br>
</body>

no mater I click the local1 or local2 or local3,the alert message never appear

from cordovaclipboard.

ctrevisan avatar ctrevisan commented on August 11, 2024

You have to change your commands to cordova.plugins.clipboard.copy and cordova.plugins.clipboard.paste.

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

thanks to @ctrevisan
but not work too by phonegap build 3.1....no "alert" message appear
I am not lying,this is the apk file,you can extract the apk file by winzip or winrar to see the index.html
http://www.littlebau.com/clipboard.apk

by the way
my config.xml "android-minSdkVersion" is 11

from cordovaclipboard.

ctrevisan avatar ctrevisan commented on August 11, 2024

The sources for the plugin are missing from your project. You should have Clipboard.java under platforms/android/src/com/verso/cordova/clipboard. This might happen if the platform was added (e.g. compiled for using phonegap) before the plugin was added. Try creating a blank project from the CLI, add the plugin, copy your basic example, and compile.

from cordovaclipboard.

bau720123 avatar bau720123 commented on August 11, 2024

I don't know how to use the CLI
I am just only use "phonegap build" and use you plugin by this address
https://build.phonegap.com/plugins/67
anyway...tks~

from cordovaclipboard.

ctrevisan avatar ctrevisan commented on August 11, 2024

Strange... Anyway, I'm glad it solved your problem :-)

from cordovaclipboard.

mahavirjain avatar mahavirjain commented on August 11, 2024

For cordova CLI use cordova.plugins.clipboard.copy and cordova.plugins.clipboard.paste

from cordovaclipboard.

kooroshekabir avatar kooroshekabir commented on August 11, 2024

@bau720123 : hi can you give me a link of your example?

from cordovaclipboard.

prantikv avatar prantikv commented on August 11, 2024

i am getting the same problem with ionic ngCordova i have opened a new issue here #14

from cordovaclipboard.

Related Issues (20)

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.