It can be used by all code in any processes with your uid.  Where are you
calling it from in the service?  Note that this function is intended to
check the permission of someone calling -in- to you and only on yourself if
you are not in that state; generally just checking if you have a permission
yourself is not a common operation, and best done with direct calls to the
PackageManager.

On Wed, Jan 21, 2009 at 6:43 PM, dreamerBoy <[email protected]> wrote:

>
> I have included a uses-permission to WAKE_LOCK statement in the
> Android manifest file.
>
>      if(checkCallingOrSelfPermission(permission.WAKE_LOCK) ==
> PackageManager.PERMISSION_GRANTED)
>      {
>         Log.i("tag", "WAKE_LOCK permission granted");
>      }
>      else
>      {
>         Log.i("tag", "WAKE_LOCK permission denied");
>      }
>
> The above code gives permission granted when run from the Activity,
> however, when run inside a Service, it gives permission denied.
>
> Is there any way to acquire a WAKE_LOCK inside a Service?  Am I doing
> something wrong?
>
> Thanks so much.
>
> Paul
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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

Reply via email to