App Inventor essentials extension

I just uploaded a new beta extension to my repo. It contains useful blocks for every App Inventor project in various categories. I'm expecially proud of the functions that sort lists in place. Please test the extension extensively. Extension, sample project and readme are available at


:exclamation: Beta means unstable - expect things to change

1 Like

Doesn't work with Companion:

grafik

However, works with compiled app (APK).

Confirmed. It's because the field is not available anymore in the newest App Inventor version

Which field? Btw, it also doesn't work with the previous AI2 version (nb183c).

You should be able to call Form.getAssetPath(String) with the empty string and it should substitute for the missing field. This should work with companions as far back as late 2018.

And again, which field?
I'm sure @Red_Panda understands it, but I don't.

Prior to the nb184 release there was a public constant field on ReplForm called REPL_ASSET_DIR that pointed to the location where the companion would place assets for projects. However, starting with this release we could no longer have it be statically computed due to the fact that newer versions of Android will no longer allow us to write to the path we previously used. We removed the constant and replaced it with something "constant-like". But the preferred way to get the path for an asset would be to use the function I quoted above.

Relevant change

3 Likes

I just pushed an update that should solve the problem (based on @ewpatton's suggestions). Unfortunately this breaks backwards compatibility for distributions that use versions prior to nb184 nb172 (see clarification below). They can use the old version for now

I'm not sure why you are claiming this. The getAssetPath method has been in the system since companion version 2.48, which would have been release nb172 (Dec 1, 2018). The only way it would break other distributions is if they were horribly out of date or went out of their way to remove this method.

Actually, I did not see that the getAssetPath method existed before. That means older App Inventor versions are supported. But still, you never know what old version a distribution uses. But that's not a big issue