Test low battery, advise by voice

Hello. I would like to create an application for old people, able to ask them by voice to put their smartphone on the charger before the battery is too low. How can I do that ? Of course, I do not want the user to have to run the application, but I'd like that the battery level is automatically checked every 10 minutes for example, and then tell the user "Please place the phone on its charger before battery is low" when battery level is < 10%. How can I do that ? Is it possible with App Inventor ? Thanks.

Hello Bruno

How many smartphones are there that do not already have that facility? More sophisticated too, with a choice of energy saving modes.

I think you would need to use an extension - Taifun has a nice one that might suit your requirement:

You would also need your App to run in the Background:

Thank you for these suggestions. I did not know about these extensions, I will try them ASAP.

I don't know about a smartphone telling you by voice that you need to put it on its charger. Moreover I am working on an application for SPC Apollo smartphones which are specific for elderly people : SPC Téléphone Intelligent Senior Apolo 1GB/16GB 5´´ Noir| Techinn

I tried to use the extensions you specified but I do not have a working result. I was waiting for my application to speak each 15 minutes, giving the percent level of battery, but nothing was heard. Should I specify the latency time in seconds or milli seconds ? You will find the AIA project in this message. Can somebody help me ? When button btnRun has been clicked, can I leave the application and wait for the smartphone to speak, or do I need to keep the application running ? Thanks.
AlertPower.aia (47.6 KB)

If the phone can do it, the function is found in something like Settings/Accessibility features.

Hi Bruno

I have moved your Topic to the Help forum, you will get a better response from there. I also modified your Title to include the all important voice element.

Itoo Beta 2.

CreatePowerService block will create a super endless service (not endless in theory). You can check for the battery (in my case it will speak if battery is lower than 90) and make it speak an audio.

The extension used in these projects are old, download and use the latest onces form the main topic.

braveaia.aia (68.5 KB)
xyz.kumaraswamy.itoo.aix (39.9 KB)

Thank you for this great sample. I am trying it now. I gave it a try by testing battery level <= 100 but still don't get any sound message played. What happens when you close the application ? Does the service keep running ? And what if you restart the phone ? Will it restart automatically ? I would like to have a service that runs forever, and which need the minimum interactivity to make it work.
I tried the sample and removed the test on battery level, but still do not hear any audio message ...

Issues:

Using Companion on an Android 8.1
failAnddroid8_1

Running compiled apk on Android 11 does not elicit an error message however chargephone.mp3 does not play when power is less than 90. :cry:

edit: on restart of Android, the compiled app plays the message 'erratically' . not every 7000 ms. :astonished:

Keep trying

For now, if the phone is rebooted, the user has to start the user again.


Possibly battery optimization issues, what the extension can do is specify an interval, but it cannot force the device to run them.

I will add a foreground service for Itoo soon, it will make it work 24/7

1 Like


bravo.aia (75.6 KB)

Installs
Runs
identifies 'low' battery almost every 7 seconds. :slight_smile:

BUT

  • refuses to shut down service ( EndService does not terminate service)
    endService

  • EndService Block refuses to shut it down.

  • I had to uninstall brave app to shut it down. :cry: it keeps repeating charge phone message.

There has to be a way to 'escape' and allow the user to disengage the app.

Keep working... :slight_smile:

2 Likes

thanks for testing :sweat_smile:

xyz.kumaraswamy.itoo.aix (46.7 KB)

This one will work :slightly_smiling_face:

Closer :slight_smile:

This code snippet terminates the service after five (5) reminders automatically and 'closes' the app.

I didn't remove the Blocks used to test and log the app behavior.

Thank you.

1 Like

Great :sweat_smile:

The counter variable should be set again in the check_battery procedure, if not it will cause an error when you move the app to background. The Itoo has to create an app environment where the variable values will be lost.

OK.

That did not seem to happen during my limited testing. Will experiment a little more. Placing the counter in Button1 seemed to work (no error) . Perhaps I missed something?


.

1 Like

Oh yeah, I had made some changes the Itoo which makes it totally replicable for the Itoo to handle things, possibly thats why it works.

Actually in our case, i think just creating a global variable is enough. You dont need to reset that, most probably it will be reset automatically.

I appreciate your interest on my project and testings. Thank you.

1 Like

something similar can now be found here

Taifun

1 Like