在离子项目中访问自定义cordova插件的项目资产

问题描述 投票:0回答:1

作为一个简单的cordova项目,我们可以通过this.cordova.getActivity().getAssets()访问项目的资产目录。

这也可以与离子结合使用吗?如果没有,是否有可能从java访问离子资产?

更新:实现我的离子应用程序后,使用this.cordova.getActivity().getAssets()访问项目资产似乎没有问题,就像在常规的android项目中一样。

javascript java android cordova ionic-framework
1个回答
1
投票

对于Android,有一个名为File Path的Ionic插件...

assets路径应该是file://android_asset

这应该导致获得一个句柄,很可能......

this.filePath.resolveNativePath("file://android_asset")
  .then(filePath => console.log(filePath))
  .catch(err => console.log(err));

也看到Cordova Plugin File,它似乎抽象。

© www.soinside.com 2019 - 2024. All rights reserved.