benCoding.AlarmManager
benCoding.AlarmManager copied to clipboard
Custom sound is not work on Android 6.0 or higher
Hello.
Notifications are playing with custom sound. When Android version 6 or higher, custom sound is not work ( notification sounds os default ).
- Android 5.1.1 => Custom sound has sounded.
- update Android version to 6.0.1 => Custom sound has sounded.
- Delete application and install same application => OS default has sounded...
code bellow
// Add this so Titanium will add the permissions and links needed to play sounds
var sound = Titanium.Media.createSound();
var manager = require('bencoding.alarmmanager').createAlarmManager();
var current = new Date();
var options = {
requestCode: 0,
icon: Ti.App.Android.R.drawable.appicon,
year: current.getFullYear(),
month: current.getMonth(),
day: current.getDate(),
hour: current.getHours(),
minute: current.getMinutes() + 1,
second: 0,
contentTitle: 'notification',
contentText: 'good morning',
playSound: true,
sound: Ti.Filesystem.getResRawDirectory() + 'notification1',
vibrate: true,
showLights: true,
repeat: 'daily'
};
manager.addAlarmNotification(options);
notification1.mp3 placed in /platform/android/res/raw
directory.
Do you know the solution?
environment
- titanium sdk : 6.0.2.GA
- AlarmManager : 0.17