Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have implemented a wab application using mvc and web api. Now i have to create a phone gap application having the same features. But i don't have any idea how to implement this.
Posted
Updated 15-Sep-15 4:26am
v3

1 solution

PhoneGap applications are designed to host Single Page Applications (SPA).

This is where a single HTML page with it's supporting resources such as javascript and css files are bundled into a package and downloaded to the phone. PhoneGap provides a native wrapper to allow your Javascript code to access the phones native API's. Extended functionality is made available through the PhoneGap plugins.

This allows the SPA to work offline as all its resources are embedded on the phone.

PhoneGap now works using NodeJS which can be difficult to set up. If developing for Android you also need the ADT kit and to install ANT. WindowsPhone has it's own problems setting up too.

The PhoneGap get started page will take you through setting up the PhoneGap dependencies.

PhoneGap Platform Guies[^]

There are many tutorials on PhoneGap development but a good YouTube series starts here:

https://www.youtube.com/watch?v=0gGBhaVG9CI[^]

Apple will reject any application which uses PhoneGap to load an internet hosted website as this creates an uncontrollable risk for them. But you can use AJAX within your SPA to access internet hosted data.

Although Apples enterprise licensing model doesn't suffer the same restrictions if your distributing your application internally within your organisation.

I've produced PhoneGap projects with the SPA approach. You can then use jQuery (Or any other AJAX approach) to to call your REST API.

How to consume a RESTful service using jQuery[^]
 
Share this answer
 
v2
Comments
prthghosh999 21-Aug-14 8:35am    
you've said javascript and css files are bundled into a package but how ??
i have html,css and js files and i want to create a set up file. so that the users can download and install it into their phone. please replay me. thank you.
Stephen Hewison 21-Aug-14 12:52pm    
You have to compile a platform specific build. The PhoneGap API installed via NodeJS will allow you to create projects for the different platforms. You drop your web files into the folders created by PhoneGap and then run the PhoneGap build command to prepare the project. This then creates project outputs which can be opened and edited before submission. For iOS it creates an XCode project to be opened in XCode on a Mac running OSX. For Android it creates a Java project which can be opened using Eclipse provided as part of the ADT download. For WinPhone this creates an Visual Studio project to be opened in Visual Studio. Each development tool compiles their own builds designed for their own platforms. These can then be submitted to their associated app stores. Although the submission comes at a cost of around £100 per year for Apple and £65 per year for Microsoft. Android is free. You could also use the PhoneGap Build service which does alot of this for you but you still need to subscribe to the platform development programs to be able to submit to the stores.
Stephen Hewison 21-Aug-14 12:53pm    
Did you watch the PhoneGap development video?
Stephen Hewison 21-Aug-14 13:01pm    
With the exception of Apple's enterprise development license you cannot produce an "Install File" to be downloaded onto the phone. The beauty of the mobile platforms is their security and ease of use which comes from all software having to be downloaded from a store. With Android you can install from untrusted sources but not by default. The user has to enable this by agreeing to a bright red "Do not do this" warning message. You can only install software onto a Windows Phone if you have the phone physically connected to the computer. So if you're looking to produce a PhoneGap application to be made commercially available then you have to subscribe to each of the platforms development programs so you can submit to their stores.
Stephen Hewison 21-Aug-14 13:12pm    
Be aware if you have no experience producing mobile applications you've got some learning to do. It took me 2 weeks to set up all the dependencies for my first PhoneGap build on iOS. Another couple of days for Android and another week for WindowsPhone. But now it's done I can produce all three platform builds in a day. PhoneGap is great because it standardises the API across all platforms meaning you only have to design your application once. But it doesn't remove the need to understand the basics on each platform and it will take a while to get used to the different development tools for each of the platforms so be patient and be prepared to spend significant time setting up your development environments.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900