Phone Events BatteryChanged doesn't run

BrutalSnyper

Member
Licensed User
EDIT:
Solved the problem. I simply hadn't used quotation marks inside the initialization.


Hi there,

I'm trying to run a few statements on the BatteryChanged event of PhoneEvents yet it isn't working. I receive no errors and nothing in the log.

The event doesn't seem to be called at all, I initialize the PhoneEvents in Activity_Create.

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("MainLayout")
   thePhoneEvents.Initialize(thePhoneEvents)
End Sub

Then I have this code in the event which never seems to be called.

B4X:
Sub thePhoneEvents_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
   lblChargeLevel.Text = "The current level of charge is: " + Level + "%"
   pbChargeLevel.Progress = Level
   Log("The battery level is: " + Level)
End Sub

Thanks in advance!
 
Last edited:
Top