I\'m developing an application with phonegap, and I have a sound file I want to play that\'s in a path like so www/Sounds/sound.mp3, and I\'m trying to access this file usin
Heres a modified version of getPhoneGapPath that works for me on both iOS and Android. It is also not restricted to only working on files that have a filename that is 10 characters long :)
getPhoneGapPath: function () {
'use strict';
var path = window.location.pathname;
var phoneGapPath = path.substring(0, path.lastIndexOf('/') + 1);
return phoneGapPath;
}
var resource = getPhoneGapPath() + 'audio/audio.mp3';
getPhoneGapPath() will return:
iOS: /var/mobile/Applications/{GUID}/{appName}/www/
Android: /android_asset/www/