Read-only archive of the All About Symbian forum (2001–2013) · About this archive

How to get the device's charging status

1 replies · 1,207 views · Started 12 August 2004

Hi, all
I want to get whether the device is charging or not, the code I used is below:
RSystemAgent sa;
sa.Connect();
TInt value = sa.GetState(KUidChargerStatus);
LogFile::WriteInteger(value, _L("isConnectedToPower"😉);
sa.Close();

if(value == ESAChargerConnected)
ret = true;
But it seems not work, the value is always -19, KErrUnknown, can anyone help me?
Thx in advice!