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

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.

this happens with your blocks.

No.

From the first error message it looks like you are using an outdated version of the extension...

Click the question mark in the designer next to the extension to find it out... You should use version 2 or 2a... you always can download the latest version from the download folder...

The version history is here App Inventor Extensions: SQlite | Pura Vida Apps

Taifun

I put a simple SQL to verify if it works and I can say that the APK works

[EDIT - this bug now fixed ]

There seems to be a problem in the code somewhere ( I have not figured it out/ fixed it yet). Tick the box in the designer for column headers. If you do not want header columns returned then set this to false with the property block (not in Screen.Initialise)

image

That's why I already asked in post #9:

1 Like

Yes, it is outdated, I buyed it in 2020: SQlite database extension. Version 1j as of 2020-10-30.
Extension Version: 1
Date Built: 2020-10-30