[FREE] Pedometer with Foreground Service

Modification of the extension prepared for sdk31

Versión 3

es.mariosoft.AcePedometer.aix (50.0 KB)

AceSteps.aia (57.0 KB)

Un saludo y buena suerte

3 Likes

Thanks Mario. However I get on start

on my Android 12 using your version 3 aia example. Any ideas?

Edit: this happens in Companion (read your post #2, thanks... seems to work using apk. :slight_smile: but time is not correct..will work on that.

--Steve

Yes, I can confirm that
This already has been reported here

For me the difference is 17 hours

Taifun

I think the time issue is fixed, it seems to work fine now

ima

I upload the extension again and aia

es.mariosoft.AcePedometer.aix (49.8 KB)

AceSteps.aia (56.8 KB)

Un saludo

1 Like

I installed the latest version, but I still have an issue with the time... it starts with 17:00:00, see screenshot... I'm located in Costa Rica, which is GMT-6...

EDIT: some more Screenshots, a new day


Starting from 8am it looks more reasonable

Taifun

New version 4

Much of the code is rewritten.

First of all to adapt the notifications to the new versions of Android

The way of formatting the time that gave errors in previous versions has been modified

The management of the database is no longer carried out by the service and is carried out from the application itself in the aia file, there is an example of how to do it.

Due to this the following blocks disappear:

image image image
image image
image

The following blocks also disappear because they are no longer needed

image image

The extension no longer uses WAKE_LOCK, to manage Doze mode, and needs Battery usage to be "Unrestricted" so that no steps are missed.

At the beginning of the App, a dialog box will open for you to manage this theme and will take you to its corresponding configuration

New blocks have been added to facilitate making a sports application

With these two blocks, it allows the application to notify us in a spoken way every X steps of the steps and time we have taken, as well as of each kilometer or mile traveled

And with these blocks it allows us to send a toast message and know what the language of our phone is

blocks (1)

blocks (1)

I hope you like it and that you serve as a beta tester

Un saludo y Buena Suerte

es.mariosoft.AcePedometer.aix (52.5 KB)

AceSteps.aia (62.1 KB)

2 Likes

Thanks for your efforts Mario.

Version 4 AceSteps aia is not working. Here is screen shot of the apk loaded on a Samsung A13 Android 12.

The pedometer does not count (does not increment steps); Time does not increment. It is just not working. :cry: The problem just might be the A13. Previous versions 'worked' with missed steps and time issues.

--Steve

Why would (disabling) battery optimization be needed when using a Foreground service?

Because if you don't do it at a certain time android sleeps the service and stops counting steps, if you put it "No Restrictions" android never sleeps the service, battery consumption is insignificant

You have configured the battery optimization to "No Restrictions", if you do not do it, the service will not start.

If you use the "Sensor Detector", check that you have authorized the "ACTIVITY_RECOGNITION" permission

But disabling battery optimization is not allowed in the Play Store.
You can try looping and playing a silent (short) sound with the Player component to prevent Doze mode using a Foreground service.


See here.

1 Like

The extension itself does not disable battery optimization, that has to be done by the user of the app, the extension only indicates where to do it.

All devices behave unfortunately, the stock android devices run fine, but some devices does not, they stop any kind of foreground service within 12 - 11 hours even if high priority is set.

He inst talking about this one, there is one more kind of feature to disable the battery optimization.

Ok but I think it's not required when using my approach. Also, this failed for me (on my Galaxy Note8) when trying to keep a timer alive.

For me, this had to be done using the System settings. When I set it manually to unrestricted

the apk works :astonished: Thank you.

Will try this later (not sure I use the Sensor Detector ' the Sensor Detector of steps that some devices carry.'

I'll continue to experiment :slight_smile:

Reset feature not working

my app force close when start extension

Does the example app work for you?
To help the developer of the extension please provide the following information

  1. the Android device and Android version you are using for your tests

  2. a logcat output

Thank you

Taifun

Are we going to have an update for this?