When someone longpresses a link and chooses share link and select my app it grabs it and does what it does.. but this also works with other sharable text items. I would like to only accept links. Currently i have the mime type as text/plain. Is there a mime type for links?
Share
No, sorry. At least for the standard Android browser, it uses
text/plain. You are welcome to examine the value that is sent to you, see if it looks like a URL via a regular expression, and pop up an error indicating that you only send links.In theory, you could even then turn around and execute
startActivity()for the sameIntent, to allow the user to choose something else to try sharing with. I have not tried this, though, so there could be some hiccups here that I am not aware of.