How do I use an SQLite 3 DB on Android 11 and up?

For Taifun's SQLite (from the documentation)

image

Do you mean I can upload the database in Designer using the Upload button or what else?

Yes, why don't you just give it a try?

Because I already tryed and did not work
Screenshot 2022-10-30 at 16-22-23 AI2

Extension version?
Try with APK.

This should work:

This thread talks about 2 different extensions... everyone gets confused...

it is very simple to import a database from the assets of your app. . Yes, for this purpose you upload the database in the media section of the designer
My documentation and example project show how to do it

Taifun

Also what about trying the example project?
Taifun

I tryed but it did not work

Use the latest version of the example project without any modifications... How do you test? Using the companion app? What exactly happens? Which device/Android version are you using for your tests?

Taifun

I am testing using the companion
I am testing on a POCO M3 Pro 5G running Android 11
At the moment I have problems to connect the companion... sometimes happens but I remember that the 1st error happened opening the app/project on http://ai2.appinventor.mit.edu and that it did not find Taifun.sqllite or a db with a similar name and then the error related to Import that I copied in this thread before.

My blocks should also work with older versions of Taifun's extemsion:

grafik

How to avoid runtime errors with the companion app

  1. After importing an extension, please restart the companion app.
  2. If you like to use an extension on a different screen, in Screen1 additionally drag the extension into the working area.

While starting the companion app, all necessary assets and also the imported extensions of your project will be copied to your device. So in case the no such class error shows up, the extension code to run the extension is not available on your device. Without that code the companion app is not able to execute methods from the extension.

In case restarting the companion app does not work for you after trying several times, then as it looks like the only way for you to test you app will be after building it using the apk file.

Taifun

  • Delete the Companion directory (→ ASD) from your test device,
  • reload the browser
  • and try again.

Yes, I know these problems but in general in my case it is a poor or slow internet connection, it happens sometimes and disappears after some minutes. This is one of the reasons I also work using AI2Offline, until the connection does not work for 5 or 10 minuter per day it is OK but sometimes it is worst.

OK, I was able to connect the companion, these are the 2 errors I see (in the right order):


Screenshot 2022-10-30 at 18-01-16 MIT App Inventor

Thanks for the extension.

SimpleSQLite
Using similar code on an Android 12 I get this error regardless of whether I use Companion or compile the apk.

Is Android 12 failing or me? :astonished:

Seems that the APK works, at least when it starts does not signal anything and also clicking the button does not signal any error, now I try a simple SQL select to see if it really works, I will update ASAP.

[quote="aiotech, post:23, topic:68834"]
I was able to connect the companion, these are the 2 errors I see (in the right order):

This path to the assets is wrong. The path to the assets is in the ASD (as I've shown in my blocks).
So try my blocks.