Extension with Rush. Keep the app running. Doze mode. Service. Notification. Source code

Your APK. It works as usual.

2 Likes

I apologize and I am ashamed of what I am about to write to you.

Having tried this APK 2, and following your explanations again of clicking start all worked fine:

So I installed the previous one, the one that in my opinion didn't work.

I realized that I was not clicking on start, so doing the only two operations: minimize and press the "Send random" button
The numbers, as already written, were read, but when I went into suspension, only the first number was read.

So it's my fault, so many excuses, clicking on Start, and putting the phone on hold, even the first .apk worked.

Thanks again for your patience and opportunity

You are authorized to write me any offensive sentence I will not be offended.

1 Like

So now we definitely confirm what I assumed anyway:

The extension works on all Android versions and most likely on all devices as well.

1 Like

The only question that remains to be answered
is whether Google will complain if you request permission to turn off battery optimization. (I think @Taifun once pointed this out.) If that were the case, the Doze problem could also be solved via a Foreground service, as I have shown with my APK.

I've never uploaded / published an app on the Play Store that requests this permission.

Always very precise and professional, congratulations.

I don't know what Google will answer.

But one thing is certain, often hours and hours of programming work are done, and then in the final test of an application, it turns out that it does not work on all mobile phones.

I really hope this solves every problem at least for this feature.

I ask you one last thing s and I'm not indiscreet, you can send the .aia file of your .apk so if google has problems I use yours.

See here:

1 Like

... and here:

1 Like

You are always very kind and thorough in explanations.
I have one last question, (I hope):
It is possible to restore the app icon, upon receipt of the number I send, with the mobile phone in suspension.

Hi everyone
I made an application using the servicio extension that receives a coordinate through the location sensor every second and sends it to Google Sheet. This application works well for a few minutes at first, but after a few minutes it stops. My phone model is Huawei y6 prime 2019 with Android 9. Please if anyone can help me. I will send the designed blocks.

Try if this example works for you:

2.- Example app.

Servicio.aia (104.9 KB)

1 Like

Thanks for your prompt reply
But unfortunately, there is still the same problem as before.
I checked your extension, but the minimize screen to background block is missing. Maybe if we use this block as foreground, the problem will be solved.

Hello
Is it possible to send me the Servicio extension that includes the minimize screen to background block?
Because I downloaded this extension, but it doesn't have this block, and in the example you provided, I noticed that this block is there.

http://kio4.com/appinventor/147_extension_servicio_rush.htm

Extension com.kio4.servicio.aix contains Background block

can you send me aia file of this apk?

Which APK?
Btw, I don't keep every app (aia) I made for testing purposes. Otherwise there would be thousands.

Hello
I want the aia file of this apk which you uploaded in this link "ServicioCuenta_2.apk - Google Drive". When I check the aia file in this link "https://community-appinventor-mit-edu.ezproxy.canberra.edu.au/uploads/short-url/dcaBWSnrOnXR6OBIwlnIkcy6BgU.aia", my phone closes after a few minutes. But when I use your apk file, it works properly. If you don't have the file, if possible, please guide me to create it.

I used a Foreground service to prevent Doze mode on Android 6+ (API ≥ 23).
I've pointed this out many times in the last years (also in the old AI2 forum).
Search the forum (for "radio", "radio app", "streaming app" etc ...).

For app apps that use location services it seems to get more complicated and they must request location permissions (btw, I've never used it myself):

@Juan_Antonio Servicio used to work with Android 11; recently updated to Android 12 and the extension is broken.

This extension unfortunately does not work anymore after the SDK31 release...
Get an error message indicating that the app must specify FLAG_IMMUTABLE when creating a PendingIntent...

Hopefully you can update it? It has been a very useful extension. :slight_smile:

Thanks,
Steve

Thanks @SteveJG for testing it.

It seems the problem is...
https://stackoverflow.com/questions/70889493/android-12-pending-intent

I have changed these lines in the source code...

///////////////////////////////////////////// NOTIFY /////////////////////////////
@SimpleFunction(description  = "Notify in status bar.")
public void Notify(String title, String text){
final Intent intentNotification = new Intent("action_call_method");
// PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intentNotification, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
	   pendingIntent = PendingIntent.getBroadcast(context, 0, intentNotification, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
    }else {
        pendingIntent = PendingIntent.getBroadcast(context, 0, intentNotification, PendingIntent.FLAG_UPDATE_CURRENT);
    }

I have updated the extension, but have not tested it.
Can someone try it? Thanks.

Servicio_v2.aia (106.5 KB)

com.kio4.servicio.aix (102.2 KB)