question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Unable to empty the clipboard on Android

See original GitHub issue

Bug Report

Capacitor Version

npx cap doctor output:

💊   Capacitor Doctor  💊 

Latest Dependencies:
  @capacitor/cli: 1.4.0
  @capacitor/core: 1.4.0
  @capacitor/android: 1.4.0
  @capacitor/ios: 1.4.0

Installed Dependencies:
  @capacitor/cli 1.4.0
  @capacitor/core 1.4.0
  @capacitor/android 1.4.0
  @capacitor/ios 1.4.0

[success] Android looking great! 👌
  Found 5 Capacitor plugins for ios:
    cordova-plugin-badge (0.8.8)
    cordova-plugin-camera (4.1.0)
    cordova-plugin-email (1.2.7)
    cordova-plugin-mediapicker-dmcsdk (2.4.7)
    cordova-plugin-simple-image-resizer (0.2.0)
[success] iOS looking great! 👌

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

Clipboard cannot be emptied using empty string / null. The clipboard stays unchanged.

Expected Behavior

The OS clipboard “string” entry should be “cleared” when calling Clipboard.write({ string: "" })

Sample Code or Sample Application Repo

Clipboard.write({ string: "ABCD" });
Clipboard.write({ string: ""});

Reproduction Steps

  1. Use the following code to set something in the clipboard :
Clipboard.write({ string: "ABCD" });
  1. Paste the clipboard anywhere. Result is ABCD
  2. Use the following code to empty the clipboard :
Clipboard.write({ string: ""});
  1. Paste the clipboard anywhere. Result should be empty but got ABCD instead

Other Technical Details

npm --version output: 6.13.2

node --version output: v11.0.0

pod --version output (iOS issues only):

Other Information

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jcesarmobilecommented, Jan 22, 2020

Sorry, I can’t reproduce.

Clipboard is a heap, so it’s not really possible to delete value, it just add a new one on top of the heap, and read return the last one. It’s possible that samsung devices pick the previous value if the last one is "".

0reactions
ionitron-bot[bot]commented, Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Help! Can not clear Clipboard because "Security Policy"
1 Solution​​ The problem seems to be with copying items while using dual messenger. If you copied the text while using the second...
Read more >
Clear the clipboard - Microsoft Support
To clear the entire clipboard, click the Clear All button. To delete an individual clip, hover next to the clip, click the arrow...
Read more >
Clear Clipboard on Android - Stack Overflow
6 Answers 6 · Copy Text From any Edit text · Press Home->compose new msg · long press edit text view · Paste...
Read more >
Fix for Cannont Empty the Clipboard in Office - Online Tech Tips
If you've been using Remote Desktop, you may get the Cannot Copy to Clipboard error because Remote Desktop uses the clipboard and it...
Read more >
3 Ways to Access the Clipboard on Android - wikiHow
1. Open any app that supports typing. This can be a note-taking app, your texting app, Google Docs, or similar. 2. Tap and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found