Air copy to clipboard doesn't work in actual app

Hello, I have my app published on google play and on the app store. When I’m on the website version and not in the actual app, I am able to copy text and elements to my clip board by using the Copy Air to Clipboard plugin. HOWEVER, when I go into my actual app, this doesn’t work and my clipboard remains empty. I have also tried to open the app in an external website via link (thinking that it the page might need chrome or a browser to copy to clipboard) but all it does is reload the app.

Any advice? I have also tried adding javascript

Hi @tarafield2015,
Thanks for reaching out!

Can you please tell us what wrapper you have used to convert your Bubble app to a native app? Was it the Air Native wrapper or other? This is important as we cannot guarantee 100% compatibility with third-party wrappers, unfortunately.

Looking forward to your reply.

Best regards,
Zeroqode Support Team

That’s true, I use BDK wrap and it doesn’t work either (now I don’t remember if it’s only on android or iphone)

This code works on my app wrapped with BDK

function copyToClipboard() {
// Select the input element
const input = document.getElementById(‘copy’);

// Copy the input value to the clipboard
navigator.clipboard.writeText(input.value)
.then(() => {
// Copying to clipboard was successful
console.log(‘Text copied to clipboard’);
})
.catch((error) => {
// Copying to clipboard failed
console.error(‘Failed to copy text to clipboard:’, error);
});
}

const copyButton = document.getElementById(‘copyButton’);
copyButton.addEventListener(‘click’, copyToClipboard);

I’ve tried it but I think I don’t get what to do…
Should I add an html element with this code?
Should I add a button with element ID “copyButton”?
Should I add the text with element ID “copy” to know what to copy?

/\ I did this, and it didn’t work for me

see example here: Bubble-solutions | Bubble Editor

I’ve just tested it here, and it doesn’t seem to work on BDK android :confused:

Hey, @tarafield2015.

Try installing the Toolbox plugin (Toolbox Plugin | Bubble). Then, add the action “Run javascript” in the workflow for copying to the clipboard. And add this code, replacing “url” with the text you want on the clipboard.

navigator.clipboard.writeText("url");

It should work :slight_smile: :computer:

This is a limitation of Android. You need to request permission in order to make it work. You can refer to this topic for more information and find out how to handle it: clipboard readtext not working in android webview - Stack Overflow

1 Like

I would do this by myself if i had Android phone

for what I understood, to solve this, it needs to be changed some configs on webviewer, like on bdk’s part, is that right?

Yeap. Shake the BDK author.

I used BDK wrapper :slight_smile: I will check out the article that Eugene suggested on Stack Overflow. For the meantime I have created a mobile version of the page that displays the link as text that sits inside a red box. There are instructions underneath that instructs the user to 'long press the red box for 3 seconds and choose ‘copy’. If the link is inside an input it doesn’t copy the entire text when the user long presses. I had to put the link inside a text field instead.

Thanks hacker, unfortunately it doesn’t work in my app on android :frowning:

Here is a guy that solved that problem, he created a plugin that works: