In a Tizen application I want to play an audio file when notification is posted and I have written below code.
function postNotification()
{
try {
var iconPath=tizen.application.getCurrentApplication().appInfo.iconPath;
var myappInfo = tizen.application.getAppInfo();
var myAudio = document.getElementById('myAudio');
var notificationDict = {
content : "Alarm Playing",
iconPath : iconPath,
soundPath : "ab.mp3",
vibration : true,
thumbnails : "icon.png",
ledColor : "#FFFF00",
ledOnPeriod: 10000,
ledOffPeriod : 5000 ,
appId : myappInfo.id };
var myNotification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
tizen.notification.post(myNotification);
} catch (err) {
alert(err.name + ": " + err.message);
}
}
The file ab.mp3 is in the same folder with js file. But its not playing that audio. Can anyone help please ?
If it's on the js folder, the path should be:
soundPath : "js/ab.mp3"
Cause the default path is "project root" folder, you have to add the folder name of the resource, as in index.html we do:
<script src="js/main.js"></script>