So PhoneGap's storage API supports webSQL which was deprecated in 2010. It's also totally broken in Chrome dev tools to test with. There is a native SQLite plugin that someone made
https://github.com/brodysoft/Cordova-SQLitePlugin
Which seems like a good idea to get the speed you need. But I'm having a huge problem testing our app before it's built for PhoneGap. We have a 10MB database and we can't import and manipulate it with webSQL. (Because webSQL crashes and just doesn't ever finish an import)
So my questions are:
1) Can you create a SQLite db file and have a PhoneGap app use that. And if so, how would you develop with that in the browser prior to building in PhoneGap? (so you can test)
2) Is there a more correct way to handle databases for a PhoneGap app?
I'm just starting with it too, but looks like phonegap 3.1 natively supports the web sql storage, refer to this link for usage:
http://docs.phonegap.com/en/3.1.0/cordova_storage_storage.md.html#Storage
I tried to perform the window.openDatabse from remote console using weinre on a test app, and successfully created the database I assigned. I'll update this when I can confirm all of the functions work properly, but I'd say that's a good hint to begin with.
Related
Is there an Android app exposing the Tango API via websockets? Would be perfect to explore via JavaScript&more without heavy deploy! cf e.g. https://goocreate.com/blog/1137/it-takes-goo-to-tango/
I'd rather avoid having to (re) learn C# with Unity or C/C++ with the Android SDK as I solely want to focus on the Tango API. I understand the performance will be TERRIBLY downgraded but compared to the time to compile and upload, at first during the exploration phase at least, I believe it's still the better path for my needs.
Suggestions welcomed.
PS: checked alternative e.g. termux + node.js + node-ffi or Mobile App - Using both Project Tango and Ionic and/or angular but that doesn't seem much better.
Suggestion: Use my TangoAnywhere App and connect to it via TCP/IP (either on the same device or remote): https://play.google.com/store/apps/details?id=de.grauonline.tangoanywhere
Since Google I/O 2017 Google provides Chromium-WebAR https://github.com/googlevr/chromium-webar , a build of Chromium providing access to getPointCloud(), getPickingPointAndPlaneInPointCloud() and for websockets since it is a web browser.
I want to be able to send music to sonos using its API. Unfortunately the only way I know is to send an URI to the device so it can download it.
I have visited already the package react-native-httpserver. This one has not been tested in Android. So I had a look over Android's nanoHTTPD and other similar packages in iOS as CocoaHTTPServer is.
It should not very difficult to create a wrapper over those packages to build something cross-platform but I wonder if there is another solution in Javascript or some work developing over react-native-tcp
I'll answer my own question, time has passed by and some packages have been released. Even with limitations, but looks promising so far:
HTTP Static server: https://github.com/futurepress/react-native-static-server
Quite flexible (but Android only) https://www.npmjs.com/package/react-native-http-server
Limited but both platforms https://github.com/alwx/react-native-http-bridge
Try to use react-native-fetch-blob https://github.com/wkh237/react-native-fetch-blob, I have used it to send pictures and It works very well. It supports both ios and Android
Brief overview of the app:
We had two(IOS Cordova & IOS native) working apps, We had a plan to integrate both the application with existing technical stack. We managed to Integrate successfully by converting the Cordova app into binaries with the help of cocoapods and integrated it into IOS native app, the app functionality is working fine.
In IOS native app we have more than one webviews.
Issue : In Cordova app sometimes we are loosing the data which is saved using "window.localStorage" this issue is not consistent but happens 2or3 out of 10 tries .
Above issue Occurs only in the Integrated version of app (Cordova + Native) and not in stand alone version of Cordova app.
We had the same kind of issue in integrated version (Android native + Cordova android) we managed to fix this issue by overriding the "windows.localstorage" using "addJavascriptInterface"
Questions :
1) Have anyone experienced the loss of localstorage value.
2) Do we have such option( ie "addJavascriptInterface" ) for IOS as well if so can you please explain how or can you suggest some other better option to commute between Cordova webview to the native layer
Note :This commute from Cordova webview to native IOS should be synchronous not asyn because I need to override the "windows.localstorage"
Used cordova version 3.6.3
Thanks in advance
Since iOS 5 the localstorage is not persistent.
The file of the localstorage is saved in the directory .../Library/Caches and this directory may be deleted by the OS if the system is very low on space. For more information about the file system in iOS see: File System Programming Guide
According to the documentation of cordova they mention the loss of data as a disadvantage of the localstorage: "iOS stores localStorage data in a location that may be cleaned out by the OS when space is required."
So in case you're running out of space the loss of data is not a bug.
Because of this problem we are looking for an alternative to localstorage, too.
After researching I've found a plugin especially for this problem. This plugin is using NSUserDefaults (iOS) and SharedPreferences (Android) to store the data permanently. This is actually my preferred solution for this problem.
Other ways out of this problem, that are suggested often are:
store the values in a file that's located within a persistent directory. This solution should work for all platforms with the file plugin.
using sqlLite. There are many plugins to provide this functionality.
I had faced same issue with some devices. There is one model out of about a dozen that we use that has similar issue. I store 6 objects (strings) in local storage and on these devices some of objects in unexpected moment may become null.
After digging stackoverflow I have found some similar cases that do not unambiguously answer the issue. For example, they reported:
localStorage cleared on app restart with Cordova 1.7 and iOS 5.1.1 — storage might not be saved if app was closed
Complete data loss Ionic / Cordova LocalStorage and Websql iOS 8.4.1 — storage might be cleared when device is low on space
https://stackoverflow.com/questions/27816556/cordova-windows-phone-localstorage-clear-on-app-update — storage might be cleared on app update
Also there were some references that some versions of PhoneGap may result in this issue.
So, there are no answers for me yet.
My own plan — to use files or SqlLite. I am sure that files that are stored with FileAPI are there and are not lost.
After deep-diving into the issue we managed to find out that the localstorage file is getting corrupted which result in loss of persisted data.
Solution which worked for us is : We started backing up the localstorage file via native layer of iOS. In our app we face this issue only when user navigate from Native stack to hybrid stack as the Native stack will always be the starting point of user`s transaction.
Note : We had integrated the Cordova app ( Cocoapods ) into Native app.
I doing a port of my Phonegap game to Windows Store. I have created a javascript project for the purpose. I have no problems connecting to the basic phonegap distribution (phonegap.js) but when I comes to phonegap plugins I have no idea how to add them to my solution...
For example I need "device.uuid" which is found in the Device-plugin.
Does anyone know how to use a Phonegap plugin when developing a javascript Windows Store app powered by Phonegap?
From the PhoneGap documentation found at http://docs.phonegap.com/en/3.3.0/cordova_device_device.md.html#device.uuid
Windows Phone 7 and 8 Quirks
The uuid for Windows Phone 7 requires the permission ID_CAP_IDENTITY_DEVICE. Microsoft will likely deprecate this property soon. If the capability is not available, the application generates a persistent guid that is maintained for the duration of the application's installation on the device.
Per the documentation, as well as Apple's stance on not using uuid anymore, I would recommend against using it. I know that stinks because it is a nice mechanism for activating/tracking devices and licensing for enterprise apps (what I was using it for). But, there are other good mechanisms for doing this if you search a bit.
Aside from that, your question is really about how to get the DEVICE plugin going. I would again refer back to the above link (just scroll to the top) and note:
Accessing the Feature
As of version 3.0, Cordova implements device-level APIs as plugins. Use the CLI's plugin command, described in The Command-Line Interface, to add or remove this feature for a project:
$ cordova plugin add org.apache.cordova.device
That command should be ran from the commandline and while in the directory/folder of your application (that you are building). This causes the config.xml to be updated and the system to download the necessary files to support this functionality on various platforms.
After doing so, the next time you issue a phonegap build <platform>, it will merge in the settings and copy the appropriate plugin files.
EDIT:
Windows Store (Windows 8) is different than the approach for Windows Phone 7/8. For that platform, see the platform guide about using Visual Studio (express edition will work) by going here.
I have been asked to create a webapp and native apps using HTML5/CSS/JS.
I should make some research, but i remember I heard about PhoneGap.
My basic question is this:
if i write a HTML5/CSS/JS that somehow interacts with a server backend (through webservices for example), this is a web application that a user can reach with a browser (or mobile browser) at a specific IP addresss.
If I "phonegap" the same code do I obtain an Android od iOS application that is already working or is there some more work in between? IF there is some more work this is not clear to me.
I am aware this is a generical question, anyway it is a programming question because I need to know if going for this single code base is an option or not.
Thanks!
I have recently built a hybrid web application using the same codebase that had to work on all major desktop browsers (down to IE8), mobile browsers and be installed as a "native-like" app on iOS and Android. For this I used jQuery Mobile and PhoneGap Build.
You can only use HTML, CSS and JavaScript for PhoneGap applications, so any data being retrieved from the server needs to be done via AJAX, but it works just fine.