You don't send this broadcast, you receive it.  I can't figure out why you
would want to send the broadcast -- there is no way you can fill it in
correctly without receiving it from the system, anyway.

If you just want to retrieve the current state, this is a sticky broadcast
so you can use the approach described in registerBroadcast() for that.

On Sun, Apr 18, 2010 at 1:05 PM, Alessandro Arturi <[email protected]>wrote:

> Hi group,
> I'm wondering if there is more simple way to receive battery level
> from code.
> At the moment I'm using a BroadcastReceiver registered at the Context
> with a IntentFilter on ACTION_BATTERY_CHANGED, all this made by code.
> My AndroidManifest.xml do not specifies about other filter or
> permission.
> In this way I would like to receive this information at runtime, so I
> thought a way is to send a broadcast like this:
>
> sendBroadcast(new Intent(Intent.ACTION_BATTERY_CHANGED),
> <some_permission>);
>
> I know that this Intent action could be sent only by the system. But
> there is some way by specifing a permission in code or using
> AndroidManifest.xml to achieve what I want?
>
> I want to have my Battery level in my code, or sending a broadcast
> like ACTION_BATTERY_CHANGED, or in some other way.
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
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, and so won't reply to such e-mails.  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