52

Is there any way to copy and paste from outside the VM into the Genymotion Emulator?

bgcode
  • 24,347
  • 30
  • 92
  • 158

6 Answers6

73

Copy/pasting text from the host into the virtual device is possible since version 2.1.0. (Note that simply updating Genymotion does not suffice, you also have to recreate the virtual device after updating to 2.1.0 or greater.)

Pasting can be performed via long tap/click + PASTE in the virtual device.

Daniel K
  • 2,613
  • 2
  • 22
  • 22
  • Sorry, I don't have a Mac, so someone else must comment on that. The only thing I can say is that after having used the copy/paste feature for a longer time now, I came across situations where it suddenly didn't work anymore and I had to reboot the emulator first (probably because the adb connection was lost). – Daniel K Aug 26 '14 at 22:00
  • 3
    I have a mac running Yosemite, and this worked fine for me on Genymotion v2.3.1. – adamdport Dec 23 '14 at 21:38
  • Is there any way to do copy/paste via keyboard shortcut? Like usual Cmd+C/Cmd+V hotkeys. – HitOdessit Oct 27 '15 at 12:46
  • 1
    I currently don't have Genymotion set up, but IIRC Ctrl/Cmd+C works to put the text into the clipboard, but Ctrl/Cmd+V does not work, you have to perform the long tap instead. You may also want to try out the proposed hotkey from the [answer below](http://stackoverflow.com/a/24350036/1236781). – Daniel K Oct 27 '15 at 15:53
  • hello genymotion interface is really slow how can i make it smooth? – MonsterMMORPG Apr 23 '16 at 07:54
  • On a Mac, you might have to click on the little selection widget which shows up after you long press, in order for the 'PASTE' option to appear. – Aralox Sep 07 '17 at 06:46
4

Since Genymotion is not support this action (even if you open VirtualBox, settings for your VM and set Shared Clipboard, it still does not work with Genymotion 2.0.3 I'm using)

So, I use an alternative way, if your text is not secret, you could use an online note like http://shrib.com/

Paste your text there then open link on Android VM, copy on it and paste to place you want. Take several step but if you don't want to type a long text (like mine, is a long SQL)

Casper Ngo
  • 323
  • 2
  • 7
4

If your Genymotion version supports copy/paste, you may use menu+C and menu+V for Copy/Paste (menu key is usually between Alt and Ctrl and acts as a right mouse button click).

4

long tap on right bottom of the mouse and release, then you can paste

1

EDIT: This solution is no longer necessary (copy-paste didn't work for me back in 2013, but it works now.)

I had a similar need awhile ago. My solution was to write a quick app that listens on a UDP port and dumps anything coming in on that port to a SMS (text) message. Then from the host machine I sent it with netcat from the shell.

UDP listener app code:

package com.example.messagemyself;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
import android.app.Service;
import android.content.ContentValues;
import android.net.Uri;
import android.util.Log;

public class GetUDPData extends Thread {
    private static final String TAG = "GetUDPData";
    private DatagramSocket datagramSocket;
    private DatagramPacket packet;
    boolean running = true;
    Service srv;
    public GetUDPData(Service s) {
        srv = s;
    }
    public void done() {
        datagramSocket.close();
        running = false;
    }
    @Override
    public void run() {
        try {
            datagramSocket = new DatagramSocket(4444);
            datagramSocket.setSoTimeout(0);
            byte[] buffer = new byte[1024];
            packet = new DatagramPacket(buffer, buffer.length);
        } catch (SocketException e) {
            e.printStackTrace();
        }
        while(running) {
        try {
            Log.d(TAG,"Receiving");
            datagramSocket.receive(packet);
            String message = new String(packet.getData(),0,packet.getLength());
            Log.d(TAG,"Received "+message);
            ContentValues values = new ContentValues();
            values.put("address", "12345");
            values.put("body", message);
            // Post to SMS inbox
            srv.getContentResolver().insert(Uri.parse("content://sms/inbox"), values);
        } catch (Exception e) {
            e.printStackTrace();
        }
        }
    }
}

Run this thread in an app (you could use the default hello-world one for example); Then to send your text message, run netcat with the -u option for UDP:

echo "my message" | nc -u 192.168.56.101 4444

Don't forget to use your genymotion ip address here.

I also went one step further and created a python script that grabs data from the system clipboard and dumps it out the UDP port. This could be useful too, especially if you want to send non-ascii text or something (in my case I needed to send Japanese characters and setting up the windows shell to display the characters turned out to be a feat that I don't wish upon the faint of heart.)

Anyway, here's the script. Dump it into a .py file and then double-click it to send the contents of the clipboard to the UDP socket.

from Tkinter import Tk
r = Tk()
datatosend = r.selection_get(selection = "CLIPBOARD")
r.destroy()

import time
import socket

UDP_IP = "192.168.56.101"
UDP_PORT = 4444

print "sending SMS: %s"%datatosend
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
sock.sendto(datatosend, (UDP_IP, UDP_PORT))
time.sleep(3)
# The sleep is not necessary, but I like it since you can see the
# message for a bit before the shell exits.
thayne
  • 186
  • 3
  • 11
0

long press the right click of your mouse until the paste sign appears

Mohammed Fathi
  • 429
  • 7
  • 10