使用 Phonegap 进行原生应用程序开发 [英] Using Phonegap for Native Application development

查看:20
本文介绍了使用 Phonegap 进行原生应用程序开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了 Phonegap.你们有没有人试过.它是一个令人难以置信的工具,它声称开发人员可以同时使用基于 HTML 5 的框架,如 Sencha touch 和 Jquery可以访问手机上的原生功能.此外,代码可以通过一些努力从 Android 移植到 Iphone.在深入研究之前,我想知道论坛对 Phonegap 的体验是什么.痛点是什么?对于企业级应用程序开发来说,它是否真正具有可扩展性.

I recently came across Phonegap. Have anyone of you tried it. Its an incredible tool which claims that developers can use HTML 5 based framework like Sencha touch and Jquery at the same time having access to native features on phone. Also the code is portable from Android to Iphone with some effort. Before I plunge into it I want to know what is forum's experience with Phonegap. What are the pain points and is it really scalable for enterprise level application development.

推荐答案

我已经使用 PhoneGap 构建了几个应用程序,它提供的功能非常棒.我想指出一些简短的笔记,它们可能对您有所帮助.

I've built a couple of applications using PhoneGap, and for what it provides, it's great. There are a couple of quick notes I would like to point out, which might help you.

禁用您不使用的基于设备的功能加速度计、地理定位功能默认开启.如果您不使用它们,我会关闭它们,因为您的应用程序会加载得更快(初始化)并且运行得更流畅.

Disable device-based features you're not using The accelerometer, geolocation features are by default turned on. If you're not using them, I would turn them off, as your app will load faster (initialize) and run smoother.

onDeviceReady - 这是在 phonegap 加载并准备就绪后调用的方法.$(document).ready 或任何你习惯的东西,在这里并不真正适用——除非你只是在做界面/硬编码的 HTML 东西.如果您要与 iPhone 功能(例如 GeoLocation)进行交互,则需要在 onDeviceReady 被调用后执行所有操作.

onDeviceReady - This is the method that's called once phonegap has loaded and is ready. $(document).ready or whatever you're used to, doesn't really apply here - unless you're only doing interface/hard-coded HTML stuff. If you're interacting with iPhone features, like GeoLocation, you will need to do everything after onDeviceReady has been called.

选择一个 UI/库界面/库、jquery-mobile、sencha touch、jqtouch 等有大量选项.这些都提供了独特的方法和功能集.做一些研究并使用一个,但避免结合使用.您可以在此处阅读更多选项和工具:http://www.phonegap.com/tool(链接已更新)

此外,更多关于一般移动开发的内容,使用 PhoneGap 如果您希望构建通过 Android 市场和 iPhone App Store 分发的应用程序,我会通读他们详尽的清单,以获取有关如何开发应用程序的指南.例如,在上面的工具链接中,有一个名为 Easy APNS 的工具/插件"——而这是对 Android 有用 - 并且在 iPhone 上技术上可行,它违反了开发协议,因为它规定你必须使用 Apple 通知网络等.这只是一个例子,但阅读这些东西会让你省去很多麻烦,如果那是你的最终目标.

Also, more on just mobile development in general, with PhoneGap If you're looking to build apps, that are distributed through the Android market and iPhone App Store, I would read through their exhaustive lists for guidelines on how to develop your app. For example, in the tools link above, there is a "tool/plugin" called Easy APNS - while this is useful for Android - and technically doable on the iPhone, it violates the development agreement, as it states you must use the Apple notification network, etc.. This is just an example, but reading up on that stuff will save you a lot of headaches, if that's your end goal.

总而言之,它非常适合轻量级应用,尤其是当您具有 Web 开发背景时.LocalStorage、GeoLocation 等.效果非常好.我希望这会有所帮助......并感觉提出问题.

All in all, it's great for lightweight apps, especially if you come from a web development background. LocalStorage, GeoLocation, etc.. works really well. I hope this helps a little... and feel to ask questions.

其他

我真的认为这取决于您想做什么,以及您知道如何做.Matt 指出,为 iOS 开发原生应用更好,等等.是的,如果你有时间和知识来学习 - 当然原生会更好.但 PhoneGap 是为 Web 开发人员设计的,他们可以利用现有技能组合构建应用程序.此外,PhoneGap 允许您快速构建应用程序,适用于 iOS、Android、Symbian、Palm、Blackberry.对每个代码库进行细微调整.

I really think it comes down to what you want to do, and what you know how to do. Matt pointed out that developing native apps, for iOS is better, etc.. Yeah, if you have the time and knowledge to learn that - of course native will be better. But PhoneGap is made for web developers that can take their existing skillset and build apps. Also, PhoneGap allows you to build apps quickly, for iOS, Android, Symbian, Palm, Blackberry. With minor adjustments to your codebase for each.

这篇关于使用 Phonegap 进行原生应用程序开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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