Friday, March 4, 2011

Re: [android-developers] Re: Verify Service is real and not a spoof one.

On Fri, Mar 4, 2011 at 5:49 PM, Kostya Vasilyev <kmansoft@gmail.com> wrote:

>
> So keep this scenario in mind - either keep it really simple and just rely
> on local service, or implement measures against code changes, like
> obfuscation and signature checking.
>

Assuming you signed both with the same key, there is a simple way to do it:

PackageManager pm = getPackageManager();
boolean isMyService = pm.checkSignatures("my.service", "my.app") ==
PackageManager.SIGNATURE_MATCH;

You can do the same thing using UIDs:

PackageManager .checkSignatures (int uid1, int uid2)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment