My attempt at accessing the clipboard on android is not working.
I’m surprised GUIUtility.systemCopyBuffer doesn’t seem to work on android.
This is the java code I need to run in unity.
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(label, text);
clipboard.setPrimaryClip(clip);
Im not quite sure how use to the getSystemService method with the Unity java object functionality
Here is my attempt that isn’t working. I don’t have android debugging working at the moment so just wondering if anyone knows offhand how to do this?
AndroidJavaObject clipboard = new AndroidJavaObject("java.lang.Object").Call("getSystemService", new AndroidJavaClass("CLIPBOARD_SERVICE"));
AndroidJavaObject clipData = new AndroidJavaObject("android.content.ClipData", "field value", selectedGameobject.GetComponent<Text>().text);
clipboard.Call("setPrimaryClip", clipData);
Im pretty sure the second and third lines would work as expected it’s just the first line.