imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 26, 2012 #1 Hi, I want to execute a loop with event batterychanged. In particular I create this code: Sub PE_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent) Dim l As Int l = Level If l = Level While l < 10 Do Msgbox ("Inserire alimentazione", "Batteria scarica") Loop End Sub but the value of level doesn't change. How can I get the new value of level, if I charge the battery?
Hi, I want to execute a loop with event batterychanged. In particular I create this code: Sub PE_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent) Dim l As Int l = Level If l = Level While l < 10 Do Msgbox ("Inserire alimentazione", "Batteria scarica") Loop End Sub but the value of level doesn't change. How can I get the new value of level, if I charge the battery?
Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2012 #2 Please see my answer in your second thread. Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 26, 2012 #3 Erel said: Please see my answer in your second thread. Click to expand... Hi, but I understand almost nothing of what you wrote. Please, have you got a sample code? :sign0104: Upvote 0
Erel said: Please see my answer in your second thread. Click to expand... Hi, but I understand almost nothing of what you wrote. Please, have you got a sample code? :sign0104:
Erel B4X founder Staff member Licensed User Longtime User Jul 28, 2012 #4 This event is raised every time that the batter level changes. It will be raised automatically. Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 30, 2012 #5 Erel said: This event is raised every time that the batter level changes. It will be raised automatically. Click to expand... Hi Erel, I use this code, to force the user to attach the power cord because the battery is running low. But when I insert the power cord, the program stops on the loop, because the value of level doesn't change. So, how I can change the code? Upvote 0
Erel said: This event is raised every time that the batter level changes. It will be raised automatically. Click to expand... Hi Erel, I use this code, to force the user to attach the power cord because the battery is running low. But when I insert the power cord, the program stops on the loop, because the value of level doesn't change. So, how I can change the code?
Erel B4X founder Staff member Licensed User Longtime User Jul 30, 2012 #6 You should remove this loop. This loop cannot work correctly. The value of L will never change. Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 30, 2012 #7 Erel said: You should remove this loop. This loop cannot work correctly. The value of L will never change. Click to expand... You're right, but I want that the msgbox appears continuously, until the user, connect the power cord. :sign0161: Upvote 0
Erel said: You should remove this loop. This loop cannot work correctly. The value of L will never change. Click to expand... You're right, but I want that the msgbox appears continuously, until the user, connect the power cord. :sign0161:
Erel B4X founder Staff member Licensed User Longtime User Jul 30, 2012 #8 It is possible to use a Msgbox. However in this case it will be much simpler to show a Panel over the whole screen. Remove the panel once the charger is connected. Upvote 0
It is possible to use a Msgbox. However in this case it will be much simpler to show a Panel over the whole screen. Remove the panel once the charger is connected.
imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 30, 2012 #9 Erel said: It is possible to use a Msgbox. However in this case it will be much simpler to show a Panel over the whole screen. Remove the panel once the charger is connected. Click to expand... But I don't know when the charger is connected. Upvote 0
Erel said: It is possible to use a Msgbox. However in this case it will be much simpler to show a Panel over the whole screen. Remove the panel once the charger is connected. Click to expand... But I don't know when the charger is connected.
Erel B4X founder Staff member Licensed User Longtime User Jul 30, 2012 #10 The BatterChanged event should be raised. Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 30, 2012 #11 Erel said: The BatterChanged event should be raised. Click to expand... How can I simulate it? Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Jul 30, 2012 #12 Erel said: The BatterChanged event should be raised. Click to expand... I thought to create a procedure, to raise the BatteryChanged, but how? Last edited: Jul 30, 2012 Upvote 0
Erel said: The BatterChanged event should be raised. Click to expand... I thought to create a procedure, to raise the BatteryChanged, but how?
Erel B4X founder Staff member Licensed User Longtime User Jul 30, 2012 #13 Calling it yourself will not help. Assuming that you are using PhoneEvents correctly then it should raise shortly after the charger is connected. Upvote 0
Calling it yourself will not help. Assuming that you are using PhoneEvents correctly then it should raise shortly after the charger is connected.
imgsimonebiliato Well-Known Member Licensed User Longtime User Aug 1, 2012 #14 Erel said: Calling it yourself will not help. Assuming that you are using PhoneEvents correctly then it should raise shortly after the charger is connected. Click to expand... I noticed that the msgbox appear continuously every 25 seconds. Is there a way, to set up the timer to 40 seconds? Upvote 0
Erel said: Calling it yourself will not help. Assuming that you are using PhoneEvents correctly then it should raise shortly after the charger is connected. Click to expand... I noticed that the msgbox appear continuously every 25 seconds. Is there a way, to set up the timer to 40 seconds?
Erel B4X founder Staff member Licensed User Longtime User Aug 1, 2012 #15 It is not a timer. Each device can send these intents in a different rate. You can check the last time that the msgbox was displayed and only display another one if 40 seconds have passed. Upvote 0
It is not a timer. Each device can send these intents in a different rate. You can check the last time that the msgbox was displayed and only display another one if 40 seconds have passed.
mc73 Well-Known Member Licensed User Longtime User Aug 1, 2012 #16 Don't all devices show warning messages when battery is running low? Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Aug 2, 2012 #17 mc73 said: Don't all devices show warning messages when battery is running low? Click to expand... Yes, but I want that the user, attach the power cord before Upvote 0
mc73 said: Don't all devices show warning messages when battery is running low? Click to expand... Yes, but I want that the user, attach the power cord before