Domanda

I want to prevent copy pasting of my mp4 and pdf files. So I want to clear clipboard containing my video to paste before it's pasted somewhere. When clipboard takes my file address for pasting then I'd like to clear clipboard to prevent copy-pasting. Alternatively I'd like to force close the app that's copying my file... Is it possible? If yes then how? I'm new to android please provide a detailed and comprehensible solution........

I've seen some site where this was suggested:

ClipboardManager clipboard = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);
È stato utile?

Soluzione

The clipboard can only copy a file URI, not the file itself, and that too only if your application implements a ContentProvider and encodes an identifier on the URI.

Users cannot simply copy your file paths by default. You have to code this behaviour explicitly.

So, you don't need to clear the clipboard since file paths won't be copied to the clipboard in the first place.

Your files are safe.

Also see the official tutorial.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top