What is the best way to link a PhoneGap app to an ASP.NET MVC application

SamJolly
SamJolly used Ask the Experts™
on
Hi,

I am interested in created an ASP.NET MVC web application and have it link through to a native mobile interface using PhoneGap, for example to get some local GPS coordinates which then downloads some related data from the server application.

Another use may be to have a Mobile form application which may use some offline storage or Mobile feature.

So is it possible to link a PhoneGap app to an ASP.NET  MVC application. Some ideas I have had is via JSON within the page. However since PG is a container for webpages then perhaps there is someway to call a miniwebpage(View) within a page???

Thoughts?

Thanks,

Sam
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hello:
The easiest way is to have an WCF or MVC website returning json.
I don't understand very well what you mean with "call a miniwebpage(View) within a page"..

Best regards.

Author

Commented:
Hi there,

1./
"call a miniwebpage(View) within a page" was my attempt at describing the notion of having say part of a webpage with a form on it which calls back to the web application. Not sure if this form would be implemented as part of the app or as a MVC view thus using some concept of a container within the webpage which contains the view, abit like the old IFrame.

2./
With JSON I guess we are treating the PG app as a seperate entity(distributed) which occasionally calls out for data via JSON from the MVC application. My knowledge of JSON is very limited so I am not sure if you can do much more with JSON than text?

Thanks,

Sam

Author

Commented:
Another thought I have had is that since the PhonGap API is called via Javascript then one would think that one could embed this JS code in the MVC Views which would get executed when called from the app.

Sam
Hello:
One of the benefits of using phonegap is that it give access to the mobile hardware, benefit that you loose if the file is not located on the device file system.
Having files locally also give much speed to your application, as long as you only need to download data, not the presentation code.
Json is highly integrated inside WCF and MVC. You won't need to build it "by hand", just return a POCO and the appropriated serializer will be called under the hood.
http://msdn.microsoft.com/en-us/library/system.web.mvc.jsonresult.aspx
http://msdn.microsoft.com/en-us/library/system.servicemodel.web.webgetattribute.responseformat.aspx

Best regards.

Author

Commented:
Thanks for your help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial