Reputation: 18919
My team developed a responsive web applications, and we were looking forward to create a mobile application for Android and iOS that just "wraps" this hosted application.
Some of the requirements were:
Listen to online
/ offline
events and automatically redirect to the website or to a custom 404 page hosted on the phone.
Notifications / Alert integration.
I spent a week with Phonegap 3
but I feel that Phonegap wasn't made to make hosted application, so it seems that I'm fighting the framework all the time.
Some complications I had with Phonegap 3
:
I had to host the plugins, cordova.js
and cordova_plugins.js
in the website and on the device, so everytime I added a plugin with cordova CLI, I had to copy everything to the website, which was very error prone.
I was able to redirect from the local 404 page to the website but not viceversa.
I had to include cordova and attach online / offline events in the 404 page and on the website.
online / offline events were triggered on the local 404 page but not on the hosted page.
Phonegap crashes if deviceready
was not triggered in 5 seconds. As all the resources were fetched from a server, this resulted on a lot of crashes.
I couldn't use plugins such as notification or vibration directly on the hosted website (with navigator.notification
or navigator.vibration
). I had to use cordova.exec
calls directly, which was ver annoying.
I'm starting to give up on Phonegap as I feel it's not helping but fighting me.
Am I taking the wrong approach for hosted application, or is Phonegap not made for this kind of things? If the latter is the case, is there a better alternative out there?
Upvotes: 2
Views: 1309
Reputation: 5799
Any existing web appliations can be easily ported to Cordova/Phonegap based app. You have to use Notifications plugin for alerts. Also there are inbuilt support for online / offline mode.
Details: http://www.raymondcamden.com/index.cfm/2013/5/24/PhoneGap-OnlineOffline-Tip
Now coming to your issues:
1) cordova.js and other plugins are directly related to mobile app platforms.
2) How are you testing your phonegap app? Using emulator like Ripple in Chrome?
3) deviceready event is specific for mobile bootstrapping.
I am sure you are doing something wrong and not an issue with Phonegap.
Upvotes: 1