Cordova features aren't work on server - android

I am a developer of DisciplineXgames! We are developing a mobile app. We have downloaded the Cordova test suite from here (https://github.com/apache/cordova-mobile-spec). When I upload this on DisciplineXgames server it shows an error in alert box "Error: Apache Cordova did not initialize. Demo will not run correctly." but when we upload the same folder on Phonegap server it works perfectly fine. Unfortunately this doesn't solve our problem as we are building our mobile app on our server and just using Phonegap to redirect the user to the page hosted on DisciplineXgames server if there's Internet in the user's mobile.
First error which I got in the console area in Google Chrome is cordova.js missing when I provided that than it outputs another error that is cordova/channel is required.
Hope you can guide us through how we can use Cordova's amazing features on our server instead of Phonegap's local server.

I am a bit confused as to what you are trying to accomplish here but I am going to take a stab.
You want to develop an app that when the app launches, it checks to see if the device has internet connectivity. If it does, then the app just opens the mobile website hosted on your servers. if there is no internet connectivity then the app ???
Since this is a very simple use case for an app, I would avoid using cordova and instead use PhoneGap Build. Simply write an index.html page and a .js file to check for the connectivity and then use the inappbrowser plugin to open your mobile site if there is connectivity. Once that is done, zip your package, upload to phonegap build and then download your compiled apps.
phoneGap Build allows you to avoid the app building overhead and the need to install things BUT prevents you from taking advantage of some of the deeper configurations and some plugins. But again, for your simple use case, PhoneGap Build sounds like the way to go.

Related

Cordova Url Loading Not Working

I am coding a Cordova application in Visual Studio. It is a hosted web app which means Cordova starts a webview with the local index.html and after deviceready, I redirect the document location to my locally hosted web url.
When I was testing on iPhone (iOS 9.3), I noticed that the Cordova app hangs/freezes at the splash screen after I rebuild the hosted web page. I thought it might be due to the latency occurring after compilation because it works in the successive trials. And I tried to debug using Visual Studio, attaching to the local device, and using the console I changed the url to test several sites. When response is immediate, no problem but when there is even about a second of latency, it does not navigate, but there seems no error in the Javascript Console of the Visual Studio debugger.
I know that there is a "loadUrlTimeout" parameter in the config.xml for Android but there is none for iOS. (I did not try it with Android if there is such a problem there too.) Am I doing something wrong? Is this the expected behavior? How can I fix it?

Allow Phonegap's inappbrowser to access phone gallery?

Our app uses Phonegap's inappbrowser to point to our website. Our website (written in Laravel) has an edit profile page where you can upload a profile pic. This works fine on desktop but in the Phonegap app tapping the 'Choose Picture' button does not bring up the Android file system or gallery. I've installed both file system plugin and file transfer plugin for Cordova and it doesn't make a difference. Is my only choice really to re-write this part of the app custom for Phonegap using JS?
<input type="file" has a lot of know errors on mobile and isn't supported with Android WebViews in general. I would suggest using the FileTransfer Plugin to accomplish what you're trying to do. Use the upload method of this plugin to manually upload the file to the remote server. Also look at the Camera Plugin to choose which image on the device to upload.
Install the plugin cordova camera and also FileTransfer, I think that could help you much more than any kind of input, remembers working in the default browser and operating system often fail with different html attributes. There are several ways to get the picture from the device to make an upload to a server. If you're only working on Android, check your code on several devices since in some models (mostly Motorola) my fault I often a code if it works in Samsung for example. Always keep your updated plugins.
Plugin Camera
FileTransfer

Deploying an iOS App using PhoneGap From Windows

I am new to PhoneGap and Mobile Application Development. I want to create an application using PhoneGap so that I can get Android, iOS, BlackBerry versions of the same app.
I have installed PhoneGap in my windows 7 Desktop using tutorials given in https://www.youtube.com/watch?v=nqFpfrUrMM4
I have some questions regrading PhoneGap:
Can we create multiple pages(HTML Files) or we only have index.html single file?
Can we use jQuery UI plugins, Mobile jQuery UI and other iQuery plugins? Will PhoneGap cloud service be able to convert to mobile app?
I have created Hello World example and uploaded zip file to PhoneGap and it converted to Android, Windows app but for iOS app it shows error certificate(P12) and provisioning file. I have windows 7, how can I get that legally? (My friend has Mac book. I can use it)
I want to launch app to Play market and iTunes but I have no idea what I need to do after uploading zip to phonegap.
I will really appreciate if you can provide me with the suggestions, steps that I need to take or links that would ease whole process.
Thanks!
You can make multi-page apps with PG. All of my apps are.
You can use those plugins. If they work on a regular web site, they'll work in PhoneGap. PhoneGap Build should be able to package all the scripts as one app, as long as the content is within their guidelines.
You need a Mac to get it. This page gives a lot of directions: http://centuryware.wordpress.com/2014/10/30/how-to-create-and-test-ios-apps-on-phonegap-build/
You'll need to sign up for a Developer account at https://developer.apple.com/devcenter/ios/index.action to upload an app there, and a Google Play account at http://developer.android.com/index.html to upload to that store. Once you sign up, read their docs. It can get pretty involved on the Apple side.

Phonegap Assistance

I have the following scenario below: Please guide me.
I already have an existing web application develop using PHP & MySql, It works perfectly on
on a normal browser. What I would like to do is have the very same functionality, on
my "Android App" "iOS" and "BB".
I have been going through multiple forums, and I am still very confused. Here are my reasons:
I do not just want to load the app in the "WebView".
I want to be able to log in to my web app through phonegap, (need to send the credentials to the web app)
After logging in I want to be able to format the generated .html (to display on mobile)
On my browser it allows me to upload content to the server, if possible I would like to this as well:)
I already have the latest version of PhoneGap + ADT & SDK + Eclipse, I can develop static html apps
without any hassles, now, I just need to have client side html that talks to my server side php.
Something similar to the Facebook app and the Facebook Mobile Version.
Any suggestions.
I have just completed a project using PhoneGap, Backbone JS and Require JS, these acted as my MVC for the front end application which sent ajax request to my back end PHP application, which was converted into a rest API. Laravel does this quite well, but it might have to be a custom build for you if you are already relying on a bespoke PHP build.
I was able to deploy to Android and iOS. However, using PhoneGap means that your application will be loaded in a WebView, this might help exaplain a WebView in more detail.

Accessing device native features in cordova webview

I am making a Hybrid Application using cordova-cli. My requirement is that the first page in my application must redirect to a website. The entire data required for the application will be loaded into this website from some other data-sources.
The requirement is to access device native features such as camera, accelerometer etc. from pages on this website.
I am using
location.href="http://www.example.com";
to open the pages. I need a unified cordova.js file with all the plugins embedded into it.
Currently I am putting the individual plugins into the lib\android\plugin\android and by using the grunt -f command from grunt-cli, the cordova.js file recieved for android does not seem to produce expected results.
Can't be done I am afraid - because of the way Cordova interacts with the device.
What happens if, using a non-mobile device, you accessed the same website from elsewhere? The website will not know what on earth Cordova is.
Cordova interacts with the native code on the device, so requires this to handle the passing of JS-to-native, and vice-versa.

Categories

Resources