App Keep alive always

I need to get location data in background and to send these data through Texting component.
Probably your extensions Locations Service and SMS receiver could do the job

Ok, I'll try this trick also

Use the locationservice extension to receive location data in the background

To send an sms is only possible in the foreground

EDIT: you could also use an API to send sms in the background, for example Twilio... SMS API | Twilio

The locationservice extension offers an interface to itoo, so you could use itoo to connect to an API in the background

Taifun

To get location data in the background you need background location permission

The locationservice extension is able to do it

What exactly means "manage texting events"?
Texting events do not work in the background together with itoo, this is why I prepared my sms-receiver extension.... however earlier you mentioned, you like to send sms in the background?

Taifun

1 Like

Hi Taifun,
I would like to create a GPS tracker that sends GPS position through SMS (or loading data to a web server) and can be activated sending an SMS to the tracker.
Probably your extensions (LocationService and sms-receiver) are actually the only effective solution

As already suggested

or store the data on your web server

Use the sms-receiver extension to activate it

Taifun

In your test aia you use a WakeLock extension that declares REQUEST_IGNORE_BATTERY_OPTIMIZATIONS in the Manifest. An app that has this permission declared in the Manifest will not be allowed in the Play Store (without Google's approval).

No problem, I think only few of my apps could be on Play Store.....

The problem is perhaps that there is little discipline in this thread. People post about all sorts of things here. The important posts are then overlooked. From 2024-09-11:

Hi, I made an update for the KeepAlive extension. But I can't test it. My best phone has Android 13.

Please download the new version from https://ullisroboterseite.de/_forDownload/de.ullisroboterseite.ursai2keepalive.aix and report back whether it works.

The version on my site is not updated!

Tested Extension Ver.1.11.0 on Android 14 (SDK 34) using "URS Keep Alive Sevice Test" app.
After pressing "Start Keep Alive Service" the application hungs

Please disable the WakeLock to make shure that KeepAlive is the problem:

start

As I already said in my email to you, I used your test app and updated the new extension version there. The app crashes/freezes on Android 14 devices. I also removed all other extensions (WakeLock, UDPSender) - without success.


Unfortunately, we don't have the source code of the new extension yet to find out where the problem might be. (The new MediaNotification ext. seems to work fine on Android 14+.)

Done, disabled Wakelock blocks
The app stucks in the same way

I found a more in-depth guide to the Foreground service and realized that I hadn't made a necessary change.

You can download the extension, the current source code and a reduced example from this link: https://ullisroboterseite.de/_forDownload/Update-UrsAI2KeepAlive.zip

This are the modifications:

In the service declaration for the manifest parameter "foregroundServiceType" was added (file UrsAI2KeepAlive.java):

@UsesServices(services = {
        @ServiceElement(name = "de.ullisroboterseite.ursai2keepalive.UrsService", enabled = "true", exported = "true", foregroundServiceType = "specialUse") })

In file UrsService.java making the service a foreground service parameter "foregroundServiceType" was added:

       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            startForeground(notificationID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
        } else {
            startForeground(notificationID, notification);
        }
2 Likes

Sorry, same issue

To find out what's going on, use logcat

Taifun

link to Explanation how to use it

The extension uses the log tag "KEEPALIVE".

You can use this command to get the log. Put it in a .bat file:

@echo off
echo clearing the log
echo.
@echo on
adb logcat -b all -c

cmd /k adb logcat KEEPALIVE:V  *:S

Connect the device with USB to your PC, run the command from a DOS-BOX. On the phone you will be asked for a debug permission. Start the test APK.

You can download a version with a lot more log statements. https://ullisroboterseite.de/_forDownload/Update-UrsAI2KeepAlive.zip . These help to fix the critical program statements.

1 Like




After turning notification enable from app info it works

This version is OK (no errors)
I simply compiled the new .aia and installed the apk, without changing any settings.

Then I made little changes : I added a clock and TinyDB component, so now the app writes the current time on TinyDb every 10 seconds.
I started the service and turned off the screen.
After some minutes I turned on the screen and checked the TinyDB records.
When screen was off, the clock.Timer didn't write any record............

Then I tried enabling notification and disabling battery limitations.
No luck.

Extension Wakelock is not needed ?