First of all excuse my English is not my native language, I use the google translator
Notice - The apps don't work with Kodular only in AppInventor
Notice - For the applications to work you must compile (they do not work in the Companion)
Since the latest version of App Inventor (nb186a), the use of services is allowed, for this the developers must program extensions for this purpose
I have developed two applications that use two Ullis Roboter Seite extensions specifically:
1.- AI2 Notifier Extension
2.- AI2 Keep Alive Extension
With number 1 I have created an alarm app that works perfectly in the background, even if the application is closed.
You need the help of the Taifun extension (TaifunBatteryOptimization)
As mentioned, it works perfectly, it allows an alarm with sounds, but for this the user must manually give it permission in the Notification Channel to use sounds.
You also allow Badges (with pending notifications), although it has not worked for me
It seems that apps compiled with the TaifunBatteryOptimization extension are not allowed by Google Play, but there is another way to allow the app to run in the background without restrictions as follows:
1.- Open System Settings
2.- Press Battery and Performance
3.- Press Battery Saver in applications
4.- Look for the app "Alarma" and click on it
5.- In the background settings select "No restrictions"
We can take the user through an AcitivityStarter to this configuration (someone would know how)
With the second extension (AI2 Keep Alive Extension), create an app that counts the steps, although the application is asleep (if it is closed it does not work), this extension creates a service in the foreground with its corresponding notification
For what functions does the user need to configure the app to work in the background without restrictions in the same way as in the Alarm app, in this app the Taifun extension does not work
With all these requirements the app works correctly and counts all the steps, it is not convenient to make an app that counts the steps continuously since the Pedometer of the app inventor counts the steps well when we walk, but it also counts them when we are on a bus or in a car, so it can be used as an exercise app with a Start and Stop button
Alarmas.aia (136.7 KB)
Walking.aia (107.1 KB)
Un saludo