Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Ionic 3使用uri从Google Drive获取文件_Android_Typescript_Ionic Framework_Ionic3 - Fatal编程技术网

Android Ionic 3使用uri从Google Drive获取文件

Android Ionic 3使用uri从Google Drive获取文件,android,typescript,ionic-framework,ionic3,Android,Typescript,Ionic Framework,Ionic3,我使用的是ionic 3.13.1框架。我的应用程序应该允许用户使用设备和谷歌硬盘上的文件。我正在使用和。所以,当我从设备内存中选择文件时,一切都很好,但我不能对google驱动器文件使用这种方法。我的函数如下所示: public OpenFile(event: Event) { this.fileChooser.open() //Open File Chooser .then(uri => { //get uri console.log(`URI: ${uri}`);

我使用的是ionic 3.13.1框架。我的应用程序应该允许用户使用设备和谷歌硬盘上的文件。我正在使用和。所以,当我从设备内存中选择文件时,一切都很好,但我不能对google驱动器文件使用这种方法。我的函数如下所示:

public OpenFile(event: Event) {
   this.fileChooser.open() //Open File Chooser
  .then(uri => { //get uri
    console.log(`URI: ${uri}`);
    ( < any > window).FilePath.resolveNativePath(uri, (result) => { //Get file path in storage from uri
      this.nativepath = result;
      console.log(`Native Path: ${this.nativepath}`);
      this.readFile(); //read data from file
      this.loader = this.loadingCtrl.create({ //Create and show loader message
        content: "Loading..."
      });
      this.loader.present();
    }, (error) => {
      console.log(`Looks like file from GDrive: code ${error.code} message ${error.message}`);        
    });
  }).catch(e => console.log(e));}
public OpenFile(事件:event){
this.fileChooser.open()//打开文件选择器
.then(uri=>{//获取uri
log(`URI:${URI}`);
(window).FilePath.resolveNativePath(uri,(结果)=>{//从uri获取存储中的文件路径
this.nativepath=结果;
log(`Native Path:${this.nativepath}`);
this.readFile();//从文件中读取数据
this.loader=this.loadingCtrl.create({//create和show loader消息
内容:“正在加载…”
});
this.loader.present();
},(错误)=>{
log(`看起来像来自GDrive的文件:code${error.code}message${error.message}`);
});
}).catch(e=>console.log(e));}
uri是:content://com.google.android.apps.docs.storage.legacy/enc%3Di2Alapnkehx4uFSbuS2U3VO_rC-nrHu3Emq8u8eF4Z9w8QvL%0A

如果文件在云中,ResolveNativePath应该返回1,但我的函数返回0,并显示消息:无法解析文件系统路径。我不知道如何修理它。
请帮帮我。我应该怎么做才能获得文件路径?

你能解决这个问题吗?@ACES,不,我没有:(我有……使用FilePath插件@Polly,你需要帮助吗?@ACES,你能把你的解决方案作为答案发布吗?