[FREE] Pedometer with Foreground Service

the app will not work in the companion for it to work you must compile it

2 Likes

Version 2 is attached that solves a Bug for which the time did not reset properly when the ResetDaily is active

es.mariosoft.AcePedometer.aix (50.0 KB) (v2)

3 Likes

Hi, I just need to test your AcePedometer as you posted with aia file. But it shows each time Runtime error.
"Neither user 10394 nor current process has android.permission.WAKE_LOCK.
Note: You will not see another error reported for 5 seconds."

Please tell me how I can solve this problem.
Thanks.

Hello, thanks for app.
Time in notification is 2 hours longer:

Why isn't there a feature to turn the foreground service off and on? I think it would be great to add. Thanks.

this extension unfortunately does not work anymore after the SDK31 release...
@Mario1 please see the error message and specify FLAG_IMMUTABLE when creating a PendingIntent...
Unbenannt2

Taifun

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.