Re: [battery] getBattery() vs. requestBattery() pattern

On Wed, 2 Jul 2014, at 07:23, Domenic Denicola wrote:
> > The Battery Status API doesn't require user permission to access the battery:  https://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html#security-and-privacy-considerations   
> 
> Right; in general we are pretty much done with infobar-style permission
> asks, as a platform. But we can still use the
> requestAccessToX().then(gotAccess, didntGetAccess) style even if getting
> access is not done as the result of an infobar. Perhaps you get access if
> you declare the need in a manifest, or if you're transported over HTTPS,
> or you get it by default but the user can toggle it off on a per-webpage
> basis. The user-facing API can still be uniform.

I don't think the requestFoo() model works very well for battery. The
API is defined in a way that if you did not get access to the battery
for the reasons listed above, we still RECOMMEND getBattery() to return
a BatteryManager with default values.

-- Mounir

Received on Thursday, 3 July 2014 09:48:22 UTC