So I'm working on a service
that will handle requests to send data to a socket.
I've done socket programming in a service
before, but only within the same application. I'd like this to just sit and do nothing until any application wants to give it data to send. That's all well and good.
I have register an intent filter
and the usual stuff and can process the data. But I want to process the data coming from different activities in different threads (subsequent calls from the开发者_运维技巧 same application will be computed on the same thread).
Is there a way to get the calling package or app or whatever? I'd prefer not to require passing in an identifier as an extra to prevent spoofing. (It's not a serious security concern, it's just each application needs its data processed in the order that it's received.)
I had run to the same issue in the past. I couldn't find a way to know how send the intent and I ended up adding an extra.
If you don't want to use an extra perhaps you might want to set an Action
but it's almost the same thing.
精彩评论