Pasting into Genymotion Android Emulator

AndroidAvdGenymotion

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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)

Solution 3 - Android

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).

Solution 4 - Android

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

Solution 5 - Android

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.

Solution 6 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBen GView Question on Stackoverflow
Solution 1 - AndroidDaniel KView Answer on Stackoverflow
Solution 2 - AndroidCasper NgoView Answer on Stackoverflow
Solution 3 - Androiduser3764420View Answer on Stackoverflow
Solution 4 - AndroidAnouar BEN ZAHRAView Answer on Stackoverflow
Solution 5 - AndroidthayneView Answer on Stackoverflow
Solution 6 - AndroidMohammed FathiView Answer on Stackoverflow