如何使用cordova创建手机间隙应用程序? [英] how to create a phone gap application using cordova ?

查看:69
本文介绍了如何使用cordova创建手机间隙应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用mvc和web api实现了一个wab应用程序。现在我必须创建具有相同功能的手机间隙应用程序。但我没有任何想法如何实现这一点。

解决方案
PhoneGap的应用程序设计为承载单页应用(SPA)。



这是将包含javascript和css文件等支持资源的单个HTML页面捆绑到一个包中并下载到手机中的地方。 PhoneGap提供了一个原生包装器,允许您的Javascript代码访问手机本机API。通过PhoneGap插件提供扩展功能。



这使得SPA可以脱机工作,因为其所有资源都嵌入在手机上。



PhoneGap现在可以使用NodeJS,但很难设置。如果为Android开发,您还需要ADT套件并安装ANT。 WindowsPhone也有自己设置的问题。



PhoneGap入门页面将指导您设置PhoneGap依赖项。



PhoneGap的平台大佬们 [ ^ ]



那里关于PhoneGap开发的很多教程,但是一个好的YouTube系列从这里开始:



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



Apple将拒绝任何使用PhoneGap加载互联网托管网站的应用程序,因为这会给他们带来无法控制的风险。但您可以在SPA中使用AJAX来访问互联网托管数据。



尽管如果您在内部分发应用程序,Apples企业许可模式不会受到同样的限制组织。



我用SPA方法制作了PhoneGap项目。然后,您可以使用jQuery(或任何其他AJAX方法)来调用您的REST API。



如何使用jQuery消费RESTful服务 [ ^ ]

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.

解决方案

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[^]


这篇关于如何使用cordova创建手机间隙应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆