Software Archive
Read-only legacy content
17061 Discussions

is posible to add external data base to apk with intel xdi?

nicolas_r_
Beginner
882 Views

is posible to get information from external data base like oracle or something like that no just the sql plugin using intel xdk building android and iOS apk ?

0 Kudos
14 Replies
Rakshith_K_Intel
Employee
882 Views

You can add a plugin to implement database in your app, here are couple cordova plugins -  sqlite and couchbase lite:

https://github.com/litehelpers/Cordova-sqlite-storage

https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin

0 Kudos
nicolas_r_
Beginner
882 Views

it can be done with php?

0 Kudos
Rakshith_K_Intel
Employee
882 Views

no javascript

0 Kudos
nicolas_r_
Beginner
882 Views

u have a tutorial or something that can help me for guide?

0 Kudos
Rakshith_K_Intel
Employee
882 Views

Here is tutorial for couchbase: https://software.intel.com/en-us/xdk/article/couchbase-sample

The 2 links for pugins I gave eariler also has documentation and examples on the github readme page

0 Kudos
Lalji_G_
Beginner
882 Views

I am very new to mobile app development and to intel xdk. So please forgive my what may seem a silly query.

I have created a basic app using Intel XDK and am now trying to learn how to use couchbase lite from the app. I have added the Cordova Couchbase Lite plugin and found my way to this couchbase sample article as kindly suggsted by Rakshith.

In the sample article it says "To get started, download this sample Intel® XDK project from Github*. I have done this but how do I "run"/"use" it. I can't open the "project" as there is no .xdk file.

Thanks.

0 Kudos
PaulF_IntelCorp
Employee
882 Views

You're correct, that sample does not include an XDK file to open it as a project, it is written as a generic web app. You'll have to start a project using a blank project and then copy the files from that github repo into the "www" folder (the source folder) in that blank project. You may need to merge the contents of the index.html file in the sample with the blank project index.html file, especially if you choose to create a "Cordova+HTML5" project and want to use Cordova plugins.

0 Kudos
Lalji_G_
Beginner
882 Views

Thanks Paul. Will try that.

Also, article mentions Couchbase's helper class https://rawgit.com/couchbaselabs/TodoLite-PhoneGap/master/js/modules.js

Is this downloaded with the sample project/plugin  or needs to be downloaded and included manually in the project seperately  

Finally i'm running Intel XDK on Windows 10 and so i assume Simulator will not work as there is no Couchbase Lite installef or is there a way around this for testing in Windowd XDK  

0 Kudos
PaulF_IntelCorp
Employee
882 Views

Looking closer at the index.html page for that project, it appears that it assumes you start with the "Cordova+HTML5" blank template, because it references cordova.js (which is a hidden or phantom script that is added at build time). The other scripts are either local to the project or retrieved externally (which is bad practice). You should get a copy of those other two and add them to your project and then refer to them locally. I'm referring to these two lines:

    <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script type="text/javascript" src="https://rawgit.com/couchbaselabs/TodoLite-PhoneGap/master/js/modules.js"></script>

If you get copies of the scripts into your project, then you'll have to do something similar to the following script line, where it references the index.js file as a local file in the projects js folder.

That couchbaselabs script is coming from this repo > https://github.com/couchbaselabs/TodoLite-PhoneGap <-- I'm not sure why the article author did it this way, and I'm not able to ask him because he no longer works here. But, in essence, that is "just another JavaScript library" that you really should download and turn into a local js file that you reference locally, not directly from the GitHub repo. Loading JS files externally is bad practice in a mobile app, because the mobile network is very unreliable and sometimes you have no network; so both of the JS libs referenced above should be retrieved and stored locally and referenced locally, not externally as shown in that sample.

0 Kudos
Lalji_G_
Beginner
882 Views

Hi Paul

I created the two files (jquery-2.1.3.min.js and modules.js) locally by copying the code from the destinations. But in the XDK code editor both show up with loads of syntax errors. So unusable.

 

0 Kudos
PaulF_IntelCorp
Employee
882 Views

The editor is probably showing you JavaScript lint errors, depending on which Brackets lint/hint extensions you've enabled. Many third-party JavaScript libraries are riddled with such errors, so it doesn't mean they will not work. Of course, you need to copy those files in their "raw" format if you want to get a proper copy into your local project. Might be better to download the files from their respective repos and copy into your project, rather than copying directly from the source page on github.

0 Kudos
Lalji_G_
Beginner
882 Views

Hi Paul

Got all that working now. Thanks. 

Now finally getting to the actual Couchbase database code. 

I'm actually developing on a Windows 10 machine. Obviously i have the couchbase plugin installed via the cdk plugin management but do i need to install any other Couchbase Lite component(s) on the machine. 

Is it even possible to simulate actuall Couchbase Lite db writing/reading from within the simulator on a windows machine?

0 Kudos
PaulF_IntelCorp
Employee
882 Views

Sorry, but we're not experts on the many third-party Cordova plugins and libraries out there. For details you need to visit the CouchBase repo and docs. When I look at that sample and article it appears to me to be a pure JavaScript library, which means it should work in the Simulate tab, but that does not imply that it will work the same way on a real device. You MUST test it on a real device, as well, preferably several. See the Simulate tab limitations page > https://software.intel.com/en-us/xdk/docs/intel-xdk-simulator-limitations < for reasons why. In particular, the way access to external sites is managed is quite different in a Cordova compared to in a browser; see > https://software.intel.com/en-us/xdk/docs/using-cordova-whitelist-rules-with-intel-xdk < for more details.

0 Kudos
Lalji_G_
Beginner
882 Views

Hi 

I accept your comments. With help from Couchbase docs etc I have manged to install Couchbase Lite on my windows machine. However not getting anywhere with the Intel Couchbase Sample. The Sample documentation is too high level and little bit more help on what's happening inside the index.js module (where all the setupconfig, setupdb, coax stuff is  would be useful. This is the ONLY example/Sample of using Couchbase Lite (or indeed any other similar db or even indexed db) via Intel XDK and it doesn't seem to be complete or accurate. It would be of great help if Intel could turn the Sample  into a proper XDK project and get it working and/or update the documentation on what's happening inside index.js and if anything needs to change in there for local config/setup (and modules.js if that needs changing).

I will probably abandon Intel XDK and move to another platform where there is more info.help/support.

Thanks.

0 Kudos
Reply