Notifier.ShowAlert not working

Hello.
My piece of blocks does not produce Alert, although I used the alert before and it works in an application I built a couple of years ago.

Please advise if this is a known bug (and if there is a workaround) or I'm doing something wrong

It might be because the conditions you've set never happen.

What Android version are you using to show alert?

I checked, and the conditions are met. Actually, that's the reason I put so many alerts in the blocks

2 Likes

I am trying this on Android 11 phone.
The application I mentioned to had built a few years ago has the same piece of blocks, and it works since it is installed on Android 9 and through phone updates up to Android 11. I do not know what would happen if I rebuild it, would not dare to try and loose a working application

1 Like

@rajo (call Notifier. ShowAlert) block can't work on Android 11,
because Custom Toast is already deprecated in that version.

For more info visit :

See also the extension i made specially for show toast/alert on android 11 & higher :

OriginalToast Extension [Free & Open Source]

1 Like

@Salman_Dev
Thank you a million, for explaining the reason for this and providing a ready workaround!

1 Like

Not sure what this is about, the AI2 notifier alert works just fine on Android 11 (companion and compiled)

1 Like

It's my pleasure :wink:

I'm sure not, because currently ai2 has targeted API level 30 and what makes me more sure is that I've seen the Notifier source code and it's very clear that MIT is still using setView(); even though it's deprecated.

believe or not please check by yourself :

appinventor-sources/appinventor/components/src/com/google/appinventor/components/runtime/Notifier.java at cc121a481d7edd75878f24c3ccac70fa8584daa8 · mit-cml/appinventor-sources · GitHub

Try it
notifiertoast.aia (1.5 KB)

2 Likes

ShowAlert works with Button my place too, but not with ListPicker

1 Like

works for me with listpicker on Android 11

image

2 Likes

@TIMAI2

I tried even simpler example, and it does not show up the alert.
image
Could you verify at your place?

alertTest.aia (7.4 KB)

Yes, it works for me, on Android 11 companion mode.

But you do need to add at least one element to select from your listpicker, in order to fire the afterPicking event!

1 Like

Deprecated does not mean, that it does not work anymore...

What does not work anymore is the ShowAlert method together with using the close application event, see here

Taifun

2 Likes

The question is, does it still work after building the app?

Taifun

Yes it does

but i have tried on my android 11 device it doesn't work at all :disappointed:

you forgot to tell us, what exactly you are testing...
EDIT: which device are you using for your tests?
try the example project

together with

Taifun
PS: I removed the checkmark for the "solution"

1 Like