Suppose a user opens up the default messaging application, scrolls through their text message inbox, and then clicks on a specific person to open up the text messages between them. Is it possible to intercept and act upon the intent fired when they click on that person's name?
To clarify, I don't want to stop other applications from receiving the intent. I suppose 开发者_Go百科intercept was a misleading word. I just want to know if there is some way to detect that the text messaging screen is being opened as well as who it is to.
I strongly believe no. Such capability would pose quite a security risk as "developers" with mischievous intentions could secretly have their app intercepting intents all throughout the device. I would suspect you have to create your own messaging app to accommodate what you have in mind.
I think you're putting to much significance on Intents.
That is actually just an action internal to the application. Not everything you click in Android results in an Intent
being fired and even if it does, not all intents are broadcast to everybody. In this case, what happens is you touch a list and it opens up another activity, likely via startActivity
(which does make use of an Intent
but not a broadcast). Additionally, it's not possible to "intercept" Intents.
You can act on them, sure, but you can't prevent other applications from seeing them if they are broadcast.
精彩评论