Problem running an apk on phones

Hey :upside_down_face: I have a problem running an apk: when I try to open it, it makes a quick black screen and then it closes. I tried on two different phones, on Samsung s10e, with android 10, and on Xiaomi redmi 5 plus, with android 8 and MIUI 11, but in both cases the apk did not work. I also tried to turn off battery optimization for the apk, but it still didn't work. There are two extensions in my aia file and as far as I know they should be supported by Mit App Inventor 2. Thanks for the help :v:

Where is your initialization block?

I tried to put "StartService" inside the initialization block, but it didn't work anyway, so then I put it inside the "click" block and I removed the initialization block

So no initialization block in your app?

No, there isn't

I think there is a problem with the "BackgroundTask" extension because other apks created without it work correctly. but I'm sure "BackgroundTask" is supported by Mit App Inventor, so it's weird...

Hmmm maybe, is it possible for you to share aia so that others can download and run the apk to figure out the problem?

You will do best to contact the BackgroundTasks extension developer directly regarding this issue

Try to remove this:

It still doesn't work

1 Like

Yes, these extensions do not work together, not even if there are no blocks.

Oh :pensive:

Can I work with my app on Niotron or are the two extensions incompatible there too? (on Kodular I can't because the "NotificationListener" extension doesn't work)

I only can say something concerning the NotificationListener extension... in case Niotron is up to date with the App Inventor sources, especially the AndroidX libraries and the service annotation then it should work there, too


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Thanks Alaqmar_Bohori, Anke and Taifun for the help :+1:

On Niotron the "NotificationListener" extension works, I tried. The only problem is when I try to use also "BackgroundTasks" extension and "Wallpaper Manager" (by Niotron): "NotificationListener" works, but the wallpaper is not set (the apk doesn't crash)... I contacted the developer of "BackgroundTasks" who was very kind and after several attempts he told me that the problem in Niotron is the "Wallpaper Manager" component which cannot work in the background. So I came to the conclusion that it is impossible to set a wallpaper in the background after reading a notification, I can neither with Kodular, nor with Mit App Inventor, nor with Niotron... :sob:

you might want to try one of the solutions to set a wallpaper from the old forum

and try it here in App Inventor

see for example this contribution by Peep

Use Activity Starter.

You can use those actions:

  1. Action: android.intent.action.SET_WALLPAPER


Action: android.intent.action.ATTACH_DATA

DataType: image/*

DataUri: file:///storage/emulated/0/dir/filename.jpg

It depend what kind app you make and where you get your data: etc. camera, internet pictures or allready stored pictures to app


Perhaps this will work for you ?

Keep Alive Service Extension by Ulli

"Wallpaper Manager" in Niotron needs an open activity...So if I used "Keep Alive Service" could it work and set the wallpaper in background, after reading a notification? And if instead I tried to use activity starter with "Keep Alive Service", could I have more chance?

Reading what you shared, I did not understand what action I should use to set the wallpaper from an image taken from the internet. "SET_WALLPAPER" or "ATTACH_DATA"?

I never tried that myself... you will have to experiment yourself...
first try the first option
Action: android.intent.action.SET_WALLPAPER
let us know, what you find out...