我应该使用在Android SDK斜坡向上的PhoneGap的呢? [英] Should I use PhoneGap instead of ramping up on the Android SDK?

查看:173
本文介绍了我应该使用在Android SDK斜坡向上的PhoneGap的呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我很舒服与Java,我与Web开发更多的经验。我期待进入编程简单的Andr​​oid游戏。

Although I am comfortable with Java, I have much more experience with web development. I am looking to get into programming simple Android games.

我应该使用Javascript / HTML编程的一切,忘记关于Java / Android的SDK斜坡吗?我想我真正的问题是,什么是PhoneGap的局限性?哪些事情要考虑,等?

Should I just program everything using Javascript/HTML and forget ramping up on Java/Android SDK? I guess my question really is, what are the limitations of PhoneGap? What are some things to consider, etc.?

一些优点,我能想到的:

Some advantages I can think of:

  • 更多选择在游戏引擎的HTML5 / JS
  • 条款
  • 更快的加速时间
  • 自动部署到所有主要的平台

推荐答案

有关的PhoneGap最大的职业是,它需要你的web开发经验的优势。我想大多数人似乎错过(或忽​​略)是有避免的PhoneGap为Android的唯一的应用程序没有任何优势!只要你想,混合和匹配的PhoneGap,你,你仍然可以编写大量本土code吧。

The biggest pro for phonegap is that it takes advantage of your web development experience. I think what most people seem to miss (or ignore) is that there is no advantage in avoiding phonegap for an android only application! You can still write as much native code as you want to, mixing and matching phonegap as you please.

我写一个Android应用程序,使用文本到语音。由于PhoneGap的不支持这个在他们的API,你可能会认为的PhoneGap是一个不错的选择,但实际上这是很容易调用Java code我需要的JavaScript:

I am writing an Android app that uses text to speech. Because Phonegap doesn't support this in their API, you might think that Phonegap is a bad choice, but actually it was quite easy to call the Java code I need from javascript:

Java的code:

Java code:

public void onCreate(Bundle savedInstanceState) {
   //boilerplate and TTS set up
    ...
    this.appView.addJavascriptInterface(this.speak, "speak");
    ...
}

public void speak(String text) {
    this.tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
}

Javascript的code:

Javascript code:

speak.say("hello world");

这篇关于我应该使用在Android SDK斜坡向上的PhoneGap的呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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