本文介绍了PhoneGap的公开文件中的本机应用程序。通过build.phonegap.com建设的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先:

是的,有在StackOverflow的很多解决方案,但其中非在我的情况下工作。

YES, there are many solutions in StackOverflow, but non of them works in my case.


  1. 我得到了应用内置SmartGWT.mobile

  2. 我连着配置文件和所有需要的文件,此版本为prepare它的PhoneGap

  3. 应用程序是通过build.phonegap.com网站建设。

  4. 它完美罚款的Andr​​oid 4.1.1

我想:


  1. 下载文件到本地文件系统中它是一个PDF文件 - 这是工作的罚款是:

var fileTransfer = new FileTransfer();
fileTransfer.download(.....


(用于例如Adobe阅读器)取安装在Android上的PDF文件

  • 在本机应用程序

    打开PDF - 它不工作

    我试过:

    (1)

    cordova.exec("ChildBrowserCommand.showWebPage", encodeURI(theFile.toURL()) );
    

    (2)

    window.plugins.childBrowser.showWebPage(encodeURI(theFile.toURL()));
    

    (3)

    window.open(encodeURI(theFile.toURL()), '_blank', 'location=yes');
    

    (4)
    即使HTML5插件打开的PDF火狐

    (4)even HTML5 plugin for open PDFs by firefox

    与所有变化的file://。不与./在前面等

    All variations with "file://" without with "./" at front and so on.

    childBrowser只显示白色画面,每次增加的http://。在前面,window.open - 同样

    childBrowser shows only white screen, each time adds "http://" at front, window.open - the same.

    我终于找到喜欢WebIntent一些有趣的事情,所以我所做的:

    I finally found something interesting like WebIntent, so i did:

        window.plugins.webintent.startActivity({
              action: window.plugins.webintent.ACTION_VIEW,
              type: "application/pdf",
              url: encodeURI(theFile.toURL().substring(7))},
              function() {},
              function() {alert('Failed to open URL via Android Intent')}
        );
    

    但它没有工作,由于事实,PhoneGap的建造不重视的类文件,它无法找到WebIntent类

    but its not working due to fact that phonegap-build not attaching class file and It can not find WebIntent Class

    我使用config.xml中声明这个插件:

    I declare this plugin using in config.xml:

        <gap:plugin name="com.borismus.webintent.WebIntent" />
    

    你知道为什么它不工作,或者我在做什么拨错?
    也许你知道其他的方式打开文件,就像在本地的应用程序,它想简单

    Do you know why it is not working, or what I'm doing worng ?Maybe you know other way to open file just like that in native app, it suppose to be simple

    我只希望我的应用程序下载和显示(在本机应用程序)的PDF用户。

    I just want my app to download and show (in native app) the PDF for user.

    推荐答案

    唐的FileOpener版本已经在我的应用程序工作科尔多瓦3.0

    don's FileOpener version have worked on my app cordova 3.0

    phonegap local plugin add https://github.com/don/FileOpener
    

    所有的XML的,插件等,然后自动添加。

    all the xmls, plugin, etc are then added automatically.

    添加 fileopener.js上的index.html
    然后

    window.plugins.fileOpener.open( path );
    

    这篇关于PhoneGap的公开文件中的本机应用程序。通过build.phonegap.com建设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 10-22 05:54