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

Last problem I have and I see in Android 11 and not in Android 8 (I am developin on these 2 releases) is a strange error initializing a SQLite 3 db. I am using a test DB then I uploaded it to AI2 using the Designer file upload but when I import the DB this error happens: " invoke: no method named `ImportDatabase' in class java.lang.Boolean". I am using TaifunSqlLite and SimpleSqlite both producing the same error. Both have a quite intuitive similar procedure/function to import the DB but the behaviour is the same. The idea is to fill the DB with customer data so the app is always the same and customers have only to fill or produce a DB with their data inside.

Show your (relevant) blocks.

For SimpleSQLite (from the documentation)

1 Like


Just a quick test but it does not work, on the smartphone seems that it is looping on Screen1.Initialize forever

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.