Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an endpoint for getting battery information #143

Merged
merged 4 commits into from
Apr 30, 2018

Conversation

mykola-mokhnach
Copy link
Contributor

just because this was requested

final Intent batteryStatus = getBatteryStatusIntent();
final int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
final int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
return level * 1.0 / scale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 * 1.0 / -1 = 1.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@mykola-mokhnach mykola-mokhnach merged commit e90a19f into appium:master Apr 30, 2018
@mykola-mokhnach mykola-mokhnach deleted the battery branch April 30, 2018 19:47
.getTargetContext());
try {
response.put("level", batteryHelper.getLevel());
response.put("status", batteryHelper.getStatus());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the response name of status to state like iOS?
Since when I implemented it in Ruby client, I faced appium/ruby_lib_core#85 (comment) error and it failed to parse status as an error code of JsonWiredProtocol.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to keep system-specific terminology. In Android this indicator is called STATUS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we can, it'd be nice to have cross-platform compatibility for the API. is that possible here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's call is state

Copy link
Contributor Author

@mykola-mokhnach mykola-mokhnach May 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll rename that property on driver level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants