I was trying to copy to the clipboard when the app is closed, But it did not copy anything to the clipboard. I saw that android 10 restricted the access to the clipboard data to read in the background, is writing to the clipboard also restricted.
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("copy", TEXT_FROM_SERVER);
clipboard.setPrimaryClip(clip);
this is the code, when something comes from the server even when the app is closed, I am calling this, but it's not working
Appreciate the suggestions. thanks