Hi, all
I'm trying to obtain the battery temperature, the battery voltage and
the battery current. The return value of the code (see below) for
voltage and batteryTemperature is always 0 while the others work. I
would like to know if there's any other way of obtaining this
information and how. Finally, I couldn't find anything in the API for
accessing the battery current... Is there any method to know its
value?
Many thanks in advance,
private BroadcastReceiver battReceiver = new BroadcastReceiver(){
//StringBuilder sb = new StringBuilder();
@Override
public void onReceive(Context context, Intent intent) {
Log.e("BATTERY_STATS", "onReceive. Changed Value");
// TODO Auto-generated method stub
context.unregisterReceiver(this);
int rawlevel = intent.getIntExtra("level", -1);
int scale = intent.getIntExtra("scale", -1);
int status = intent.getIntExtra("status", -1);
int voltage = intent.getIntExtra("voltage", -1);
int batteryTemperature =
intent.getIntExtra("temperature", -1);
if (status>=1){
status=1;
}
int level = -1;
if (rawlevel >=0 && scale >0){
level = (rawlevel*100)/scale;
}
String batteryTechnology =
intent.getStringExtra("technology");
//SAVE VALUES
}
};
--
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