Camera issue / API 29 (AI2, Kodular, ...)

See here:


https://groups.google.com/forum/#!searchin/mitappinventortest/camera$20android$2010|sort:date/mitappinventortest/tERag1ZlqZQ/WHWHSRkPCgAJ

2 Likes

How about the permission WRITE_MEDIA_STORAGE ?

This is an old (outdated) permission regarding the external SD card.
There is no longer any reference to this:
https://developer.android.com/reference/android/Manifest.permission

Btw, no Camera issues with Thunkable X on Android 10.

Here are the Manifests (permissions) from AI2, Kodular and Thunkable:

Here is the logcat from an OnePlus 6 (API 29) on AI2 (nb181):

logcat_OP6_API29.txt (18.0 KB)

I think I’ve identified the problem. Please try the test server here. It has a new companion and build servers with a potential fix.

1 Like

Yes, both work, Companion & APK.
(checked on an OnePlus 6, Android 10)

So what was the problem if it isn’t too complex to explain?

Android Q is moving away from the idea of the external storage as a globally writable space. Apps that target SDK 29, like the Camera app bundled with it, will abide by this constraint. However, we were handing the Camera app a target file for the image that would violate this constraint. The file won't get created, so App Inventor thinks that nothing was returned (which I guess is true, but not for the reason it thinks). The change I implemented uses the FileProvider (added in Nougat, SDK 24) to get a content URI that the Camera can use to write the image back to the app.

Proposed change on GitHub if you're interested:

2 Likes

Of course, thanks.
I posted this link in the Kodular forum.

1 Like

Would be good to make it public :slight_smile:

1 Like

For anyone experiencing this problem, the potential fix is now available to test on ai2-test.appinventor.mit.edu:

1 Like