benbahrenburg / benCoding.AlarmManager

Titanium Module for working with the Android AlarmManager
Other
98 stars 85 forks source link

Custom sound is not work on Android 6.0 or higher #80

Open Kurom96 opened 7 years ago

Kurom96 commented 7 years ago

Hello.

Notifications are playing with custom sound. When Android version 6 or higher, custom sound is not work ( notification sounds os default ).

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