什么是机器人本地及QUOT; URL"电话峡, [英] What is Androids Local "URL" Phone Gap,

查看:196
本文介绍了什么是机器人本地及QUOT; URL"电话峡,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本地URL的Andr​​oid手机应用差距确实存在?

Does a local "URL" for Android Phone Gap applications exist?

如果是这样,可能有人点我在它的方向是什么?

If so, could someone point me in the direction of it?

喜欢的东西?本地://%AppName%/www/file.html

Something like "Local://%AppName%/www/file.html" ?

推荐答案

好吧,我不是100%确定您想要达到。

Well, I am not 100% sure about your want to achieve.

如果你想在您的应用程序所在,那么你必须先得到文件系统和点到应用程序根目录的文件系统路径。在那里,你可以选择某些文件。

If you want the file system path where your app resides then you have to first get the file system and the point to the app root directory. There you can pick certain files.

这是我目前的code的一部分,有点要注意调整code,以满足您的需求,这对因为是我自己写的方便。

This is part of my current code, bit be aware to adjust the code to fits your needs, this was written for as is for my own convenience.

var app_FileSystem;                     // Application file system path. Variable to ease access to the file system instead of instatiating it each time is required

// Get the application data path, NOTE: first run Get Application File system function.
function GetAppDataPath ()
{
    var appDataPath;
    appDataPath = app_FileSystem.root.fullPath;

    return appDataPath;
}

function GetAppFS ()
{
    var self = this;
   self.state = "";                     // store the state of the process for debuggin purposes
   self.fileSystem = {};

    window.requestFileSystem ( LocalFileSystem.PERSISTENT, 0, getFileSystemSuccess, dispatchFailure );

    /**
     *
     * Called when we receive a valid file system. Once we do that, we need to ask for all
     * the documents within the file system.
     *
     */
    function getFileSystemSuccess ( fileSystem )
    {
        self.state = "Received File System";
         self.fileSystem = fileSystem;
        app_FileSystem = fileSystem;
         OnFSReady (); // trigger a function that do something one the FS is ready
    };

    function dispatchFailure ( e )
    {
        console.log ("While " + self.state + ", encountered error: " + JSON.stringify(e));
         alert ("File Sys ERROR ");
    };  
}; 

编辑:
很明显,你可以code所有这一切在更短的版本,但是是我不得不迅速帮助你。

Obviously you can code all of that in a shorter version, but is what I have to help you quickly.

这篇关于什么是机器人本地及QUOT; URL"电话峡,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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