Sunday, February 9, 2014

android service how to get the caller's package name


            
In fact, I demand is for an application to be a private service, but the service can not put yourself inside. So I should be able to have a need to assist the identification of the caller.
Reply:
Did not know the amount of the relevant api
But you can get to call your service's intent, which might contain this context

There is a rogue in the onCreate method is inside your service and use of new exceptions try to wrap
For example try {
Log.v ("", "", new Exception ());
...}
Then go to the stack information, call stack to analyze parsing
Reply:
Dude you are too strong, and this approach is absurd, is not very harmonious ah, I just found an api can get, being debugged.
Reply:
 intent.getComponent () getPackageName ();. 

Reply:
reference to the second floor gaara0816 reply:
buddy you're too strong, and such methods are absurd, is not very harmonious ah, I just found an api you can get, being debugged.

How are you doing buddy Finally, I would like to achieve this, seeking advice

No comments:

Post a Comment