FileOpener in ionic2 for android

Hello, Im using FileOpener in ionic2 native

Doc here : http://ionicframework.com/docs/v2/native/fileopener/

this is my code :

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { FileOpener } from 'ionic-native';

@Component({
  selector: 'page-installHelper',
  templateUrl: 'installHelper.html'
})
export class InstallHelper {

  constructor(public navCtrl: NavController, public fo: FileOpener) {
        fo.open('/assets/app.apk', 'application/vnd.android.package-archive');
  }

} 

but it gives an error says : Property 'open' does not exist on type 'FileOpener'.

Any help with this please ? I want to open an apk file from my App.

Solved this problem by making it like this :

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { FileOpener } from 'ionic-native';

@Component({
  selector: 'page-installHelper',
  templateUrl: 'installHelper.html'
})
export class InstallHelper {

  constructor(public navCtrl: NavController) {
              FileOpener.open('assets/app.apk', 'application/vnd.android.package-archive').then(
      function(){
	      
	      console.log("success");
	      
	      }, function(err){
		      
		      console.log("status : "+err.status);
		      console.log("error : "+err.message);
		      
		  });
  }

}

but no I can’t access the file app.apk which is in assets/app.apk

and I get the error :
Status : 9
Error : File Not Found

is it even possible to access a file within the app folders ?

I’m also trying to figure out. I’m getting the same error as yours, “Error: File Not Found”.
Where’s the root directory for the url so the file can be opened? Any workaround?

openURL(url) {  
FileOpener.open('assets/'+ url, 'application/pdf').then(
  function(){
      
      console.log("success");
      
      }, function(err){		      
	      console.log("status : "+err.status);
	      console.log("error : "+err.message);
	      
	  });

}

Same problem here, I would like to open a PDF located in my assets directory, tried with FileOpener and got the same error “File not found”.

Maybe we should use another native module ? Has anyone managed to do it ?

Well guys if anyone still curious … I already solved this problem by not taking on the getting the file from assets because this is kinda impossible thing working with hybrid … if we were working native this would be possible.

so to make this happen I made the file I needed downloadable from my web server www.mywebiste.com/file.apk and used this code to download it and install it on the android device :

import { Component } from '@angular/core';
import { Platform, LoadingController } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { FileOpener } from 'ionic-native';
import { File } from 'ionic-native';
import { Transfer } from 'ionic-native';
import { HomePage } from '../pages/home/home';
declare var cordova: any;


@Component({
  template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
  rootPage = HomePage;

  constructor(platform: Platform, public loadingCtrl: LoadingController) {
	  let me = this;
    platform.ready().then(() => {
	    
	  let loading = me.loadingCtrl.create({
	    content: 'Preparing Download ...'
	  });
	  loading.present();
	  File.createDir(cordova.file.externalDataDirectory, "app", true).then(function(link){ 

		  const fileTransfer = new Transfer();
		  let url = 'http://myserver.com/app.apk';
		  fileTransfer.download(url, cordova.file.externalDataDirectory +"app/app.apk").then((entry) => {
			loading.dismiss();
			FileOpener.open(entry.toURL(), "application/vnd.android.package-archive").then(
			  function(){
		         console.log("success");
		      },function(err){
			      console.log("status : "+err.status);
			      console.log("error : "+err.message);
			  });
		  }, (error) => {
		    console.log(error);
		  });
		  
	  },function(error){
		  console.log(error);
	  });


      StatusBar.styleDefault();
      Splashscreen.hide();
    });
  }
}

any questions im here. and good luck.

i am using same code some devices work well but with some devices i get error:
Activity not found: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.ionicframework.power10fs142463.opener.provider/external_files/Android/data/com.ionicframework.power10fs142463/files/newVersions/Power10_FS_0.4.apk typ=application/vnd.android.package-archive flg=0x40000000 }"

Any solution??
Thanks

Make sur that the folder name created using FIle is the same where you save you apk file ?

Otherwise share your code so we can help