Get absolute path to assets folder in PhoneGap

后端 未结 3 845
旧时难觅i
旧时难觅i 2020-12-31 10:05

Is there a way to get the absolute path of an image in phonegap asset folder?

I need the absolute path to attach the image in a mail using EmailComposer plugin.

3条回答
  •  一整个雨季
    2020-12-31 10:38

    Just in case somebody is still looking for a solution. Now Cordova implements a really easy way to get the current application directory (supported on Android, iOS and BlackBerry 10) :

    cordova.file.applicationDirectory

    For example, if you want to access an audio file in your res/audio directory (within your www), you just have to write that :

    cordova.file.applicationDirectory + 'res/audio/my-audio-file.mp3'

    Here is the complete documentation

提交回复
热议问题