How do I copy to clipboard on Android?

0 favourites
  • 10 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games. Suitable for casual games
  • Hi,

    is there any way to copy a string to the clipboard?

    The clipboard addon doesn't work on Android, worker mode set on "auto".

    And if it's a permission issue, how can you ask for the permission?

    Thanks in advance!

    Tagged:

  • Hi,

    is there any way to copy a string to the clipboard?

    The clipboard addon doesn't work on Android, worker mode set on "auto".

    And if it's a permission issue, how can you ask for the permission?

    Thanks in advance!

    here's an example

    https://www.construct.net/out?u=https%3a%2f%2fwww.dropbox.com%2fs%2f6g57u4ad24n6ymo%2fClick-To-Select.c3p%3fdl%3d1

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Is this a new issue? I'm seeing it in my new game, too. Normally, when I search for a problem I'm having I find messages that are often 7 or 8 YEARS old. This post is only about a week old...

    Does it matter whether web worker is on "auto" or not?

    The proposed solution may not work for me.

  • Which export option are you using? Clipboard features should work in Chrome on Android. However if you're exporting an Android app there's a known issue that currently prevents copying to the clipboard from working.

  • My game is only online. Some of my Android users are saying that sharing isn't working for them. I'll check to see which browser they are using.

    For right now, I'm simply grabbing the text in a text box and copying it to memory using the clipboard object. Then users can paste it into Facebook, e-mail, or wherever. (Similar to what Wordle is doing on PC.)

  • I have been talking to one of my testers who is having trouble with the clipboard share on his Android phone. (I have created a web app only.)

    NOTE: My tester is a professional game programmer.

    He wrote:

    I am using GBoard as my keyboard. The Clipboard icon is third from the left for me, and it reports that the clipboard is empty even after clicking the "Share" button and seeing "Results copied!" below the button.

    This is interesting. If I use Chrome directly and go to worddad.com, the clipboard works fine. However, the clipboard does not work if playing the game through a link to worddad.com via the Facebook app.

    It looks like I can paste the clipboard contents that come from Chrome into a textbox inside the Facebook app and that works fine. So, my guess is that there is a permissions issue within the Facebook app that is blocking access to the clipboard in a Facebook app-launched browser instance.

    Is this something that needs to be (or can be) fixed in Construct 3?

  • It's not clear what you're doing. Are you using the Share plugin or the Clipboard plugin?

    If you think there is a problem with Construct than as ever the best way to deal with it is to file an issue following all the guidelines.

  • It's not clear what you're doing. Are you using the Share plugin or the Clipboard plugin?

    I am ONLY using the Clipboard object. I have at least two players, using Android phones, who are reporting that the Clipboard object only works if they type the URL for the game into a browser window. If they follow the game link on Facebook, however, the Clipboard object doesn't work. (It doesn't copy anything.)

    I filed a bug report and attached a small sample project.

  • I'm going to post a quick reply for closure.

    I filed a bug report on this issue: github.com/Scirra/Construct-bugs/issues/7296

    Ashley closed it with this comment: "The underlying Clipboard API works in Chrome, but a known issue is currently preventing it from working in the Android WebView. I would guess when viewing in the Facebook app it is using the Android WebView instead of the real Chrome browser so is running in to that bug. I'm afraid there's nothing we can do until Google fix the issue."

    So the problem only seems to happen when someone accesses my game from the Facebook link. There are two player workarounds:

    1. Type the URL for the game directly into the browser

    2. After clicking the link, one can click the "..." at the top right corner of the Facebook browser and select "open in external browser". Then the clipboard will work.

  • FWIW on the relevant Chrome issue it looks like they just fixed support for copying only (but not yet pasting). It'll take a couple of months for the change to arrive in a stable release, but then at least the copying feature should always work on Android, even in the WebView.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)