This is a migrated thread and some comments may be shown as answers.

large local SQLite database

3 Answers 197 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tim R
Top achievements
Rank 1
Tim R asked on 15 Apr 2015, 02:13 PM

Let's say we wanted to give a small team (say a dozen people) a mobile app for their tablets, which referenced a large (300MB) SQLite database.  They're going to be using this app in remote locations with terrible mobile reception, or even none at all, so instead of talking to the database on a remote server via an HTTP webservice, we want to copy the database file itself onto the memory cards in their mobile devices.

Can the Telerik AppBuilder accommodate that scenario?  If yes, could you please describe the general approach.  What plug-ins or native functionality would be required to execute SQLite queries against a database file? Is there a Javascript SQLite provider? Or would there be a Telerik wrapper around a native SQLite library?  Thanks.

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 17 Apr 2015, 03:59 PM
Hi Tim,

You can incorporate as a local data provider in your app an SQLIte instance. To do this you need to use the SQLite plugin for Apache Cordova. Here is the page for the plugin from the Telerik Verified Plugins Marketplace. Documentation and sample app are included.

However, you may want to consider the application package limit for submission in the vendor-specific stores. Here is the information for Android and here - for iOS (large PDF file - scroll down to page 67).

Usually, SQLite database instances are initialized on demand when the app starts, however, in case you are submitting the pre-polulated database with your app it should be placed as an additional resource to the app in the Assets/Resources folder in order to fit the app package limitations. I found this Cordova plugin that claims that it allows to copy the pre-populated db from the Assets/Resources folder to the application folder and you will be able to work with the database in your app and overcome the app size limitation.

On the other hand, AppBuilder doesn't have any specific size limitations for the cloud builds. I must, however, admit that if you have a large project exceeding 100MB, you might experience some delays to the build operations in the cloud.

Could you specify, does your app require synchronization of the data created offline (if such)? Usually, this kind of applications are designed in a way that the application consumes the required data from the company server when it is online, saves the data to the local data provider and then continues to operate in offline mode. When there is a network connection available again, the data is again synchronized.

I hope that this helps. Let me know if further questions arise.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Tim R
Top achievements
Rank 1
answered on 17 Apr 2015, 05:16 PM

Thank you for the information, Anton.

The  application would not require frequent synchronization (at most four times per year) and we would probably not do it via the cloud.

 Since the database is so large, we would not want to download the 300MB file to the device over the cloud. Ideally, we'd like to use native file-system access privileges to point the app at the database file on the device's memory card.

Is a NativeScript SQLite provider feasible?

When the app is not  for public consumption, is there a way to put it on the mobile device  bypassing the app stores?

 

0
Anton Dobrev
Telerik team
answered on 22 Apr 2015, 12:17 PM
Hello,

Thank you for specifying this. As to your questions.

According to this issue in Cordova (which apparently won't be fixed), in a project that uses Apache Cordova, you cannot open/use a database located on the SD card (due to the pattern used to resolve a file path).  It appears that you may consider some of the following:
 - Downloading the data from the company servers at the first launch.
 - Ship the database as a resource and copy it to the app's directory prior to opening it (presumably with the suggested plugin in my previous reply)
 - At the first run of the app - copy the contents of the file from the sdcard to the app storage (using the Cordova File API) and start using it in your app from there.
  - Initialize the database with a SQL statement on the first run of the app.

In regard to the SQLIte support in NativeScript, this functionality is not yet implemented in a NativeScript module. You can follow the feature request here. If this fits in your scenario, in a NativeScript app you can also use the File System API to access and work with local files on the device app.

Using the iOS Enterprise program should drop the limit for the app packaged file size. For Android, the size of the app package applies only to apps submitted to the Google Play store. However, with a larger file package you might experience a lot of delays and timeouts during the AppBuilder build in the cloud (the process that builds the project to an application package ready for deploying to devices).

Let me know if this helps.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
General Discussion
Asked by
Tim R
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Tim R
Top achievements
Rank 1
Share this question
or