-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't access cordova.plugins.clipboard API only iOS. #13
Comments
Prefix with |
I´m having a very similar problem, it works fine on Android, but on ios it does nothing, have you find any solution? |
@Martherius Can you show me your code implementation for the clipboard call? I'm on a newer machine and don't have everything I need set up to debug at the moment. |
This is the code on my controller.js im working on an ionic 1 app: Then just call the method in the html template: |
@Martherius have you tried prefixing with |
You mean instead of this:
I do this:
ok thanks a lot this works for ios, although the notification does not show now also this stopped working on android but i guess i just need to build android with option 1 and ios with option 2 also sorry to ask but i have one more issue with my app, i'm using com.darktalker.cordova.screenshot to take screenshots in the app and share them, works fine with iOS but for android works only on android 10 or less devices, android 11 and up it's not working anymore |
@Martherius I'm glad you made some progress! I believe the same code worked for me on both iOS and Android. I've only used this plugin atop a Vue-based Cordova application. You'll just want to make sure the code can access the plugin within its current scope. I'm not familiar with the screenshot plugin, you may want to follow up by raising an issue with them. FYI for anyone else reading this here's an example I had working (a year ago, at least) to copy a remote image to a clipboard: copyImage(url){
return new Promise((resolve, reject) => {
let folderpath = this.getSavePath();
let filename = "Treet-Photo.png";
window.cordova.plugin.http.downloadFile(url,null,null,folderpath+filename,(fileEntry) => {
fileEntry.file( (file) => {
let reader = new FileReader();
reader.onloadend = function() {
// console.log("Successful file read: " + this.result);
window.cordova.plugins.clipboard.copy({
type: 'image',
data: this.result
}, (res) => {
resolve(res);
});
};
reader.readAsDataURL(file);
}, (e) => { reject(e); } );
}, (e) => { reject(e); });
});
}, |
Hi team!
Thanks for your good products.
I want to paste text to use this plugin.
Android OS worked well. But, iOS didn't work.
Error is here.
TypeError: undefined is not an object ( evaluating 'cordova.plugins.clipboard')
It's impossible to access "cordova.plugins" to use only iOS. (Android is fine.)
Please teach me how to resolve this problem.
The text was updated successfully, but these errors were encountered: