Android上的PhoneGap Childbrowser? [英] Childbrowser with phonegap on Android?

查看:117
本文介绍了Android上的PhoneGap Childbrowser?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能让childbrowser在Android上工作。
我按照说明书上:的https://github.com/brycecurtis/phonegap-plugins/tree/master/Android/ChildBrowser/

我已经安装了Eclipse和所有编译需要其他的东西
应用程序,所有的作品,因为它应该。
它是在模拟器中运行,我也可以创建一个apk文件。

所以现在我试图让childbrowser工作,如下图所示。


  1. 我增加了childbrowser.java文件中我的工作区/ APPNAME /
    SRC / COM / PhoneGap的/插件/ childBrowser /文件夹。

  2. 在我的工作区/应用程序的名字/资产/ WWW的childbrowser.js文件/
    夹。

  3. 我已经联系到phonegap.0.9.4.js和childBrowser.js
    文件在我的索引文件。

  4. 我添加了这个清单文件


 > <活动机器人:名字=com.phonegap.DroidGap
>机器人:标签=@字符串/ APP_NAME>
> &所述;意图滤光器>
> &所述; /意图滤光器>
> < /活性GT;



  1. 应打开childbrowser链接看起来是这样的:


 < A HREF =#的onClick =window.plugins.childBrowser.showWebPage(thewebpage.html);>开放< / A>


和它仍然不能正常工作?我只是在模拟器中进行测试,因为我没有Android手机现在在这里,是不是childbrowser在模拟器中工作吗?
或有我错过了什么东西?
谢谢你。


解决方案

我用phonegap.0.9.4.js以及,它是为我工作。 PhoneGap的JS抛出事件deviceready后childBrowser应该工作。所以我增加了以下code。

  VAR URL =htt​​p://www.google.comdocument.addEventListener(deviceready,onDeviceReady,FALSE);功能onDeviceReady(){
    window.plugins.childBrowser.showWebPage(URL);
}

一些技巧,因为我遇到的一些问题,以及:


  1. 我下载JavaScript文件是childbrowser.js,全部小写,不childBrowser.js

  2. 确保该ChildBrowser.java在正确的文件夹编译。检查日食bin文件夹

  3. 对于外部网页,使用http://在前面

  4. JavaScript的是Android和iPhone不同。例如在Android上,你不叫ChildBrowser.install();因此,例如code也是为iPhone / Android版/黑莓
  5. 不同

I can't get the childbrowser to work on Android. I have followed the instructions on: https://github.com/brycecurtis/phonegap-plugins/tree/master/Android/ChildBrowser/

I have installed Eclipse and all the other stuff needed to compile an app and all works as it should. It is running in the emulator and I can also create an apk file.

So now I'm trying to get the childbrowser to work, like below.

  1. I added the childbrowser.java file in my workspace/appname/ src/com/phonegap/plugins/childBrowser/ folder.
  2. And the childbrowser.js file in my workspace/appname/assets/www/ folder.
  3. I have linked to the phonegap.0.9.4.js and the childBrowser.js files in my index file.
  4. I added this in the manifest file

>     <activity android:name="com.phonegap.DroidGap"
> android:label="@string/app_name">
>             <intent-filter>
>             </intent-filter>
>             </activity>

  1. The link that should open the childbrowser looks like this:

   <a href="#" onClick="window.plugins.childBrowser.showWebPage("thewebpage.html");">Open</a>

And it still isn't working? I'm just testing in the emulator as I don't have a android phone here right now, isn't the childbrowser working in the emulator? Or have I missed something else? Thanks.

解决方案

I use phonegap.0.9.4.js as well and it is working for me. The childBrowser should work after PhoneGap JS throws event 'deviceready'. So I added the following code.

var url="http://www.google.com";

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    window.plugins.childBrowser.showWebPage(url);       
}

Some tips, as I encountered some issues as well:

  1. The javascript file I downloaded is childbrowser.js, all lowercase, not childBrowser.js
  2. Make sure that ChildBrowser.java is compiled in the correct folder. Check eclipse bin folder
  3. For an external web page use http:// in front.
  4. The Javascript is a different for Android and iPhone. For example on Android you do not call ChildBrowser.install(); So example code is also different for iPhone/Android/BlackBerry

这篇关于Android上的PhoneGap Childbrowser?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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