Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Alarm manager can not call a service

$
0
0

I am using bencoding module to set alarm ... i am using this code below and nothing appears .. Here is my code

var intent = Titanium.Android.createServiceIntent( { url: 'myservice.js' } );
var service = Titanium.Android.createService(intent);
 
 
var alarmModule = require('bencoding.alarmmanager');
var alarmManager = alarmModule.createAlarmManager();
 
var now = new Date();
 
alarmManager.addAlarmService({  
    service:'com.app.AlarmTest.myservice',            
    requestCode:44,
    year: now.getFullYear(),
    month: now.getMonth(),
    day: now.getDate(),
    hour: now.getHours(),
    minute: now.getMinutes() + 2, //Set the number of minutes until the alarm should go off
    repeat:'daily',
    contentTitle:'Alarm Wake up', //Set the title of the Notification that will appear
    contentText:'Alarm & Notify Scheduled... Please Wake up!!!', //Set the body of the notification that will apear
    sound:Ti.Filesystem.getResRawDirectory() +'alarm.mp3',
    playSound:true, //On notification play the default sound ( by default off )
    vibrate:true, //On notification vibrate device ( by default off )
    showLights: true
}); 
console.log("Alarm Added.");
and my service file like this
alert("Hello . I am service");

Viewing all articles
Browse latest Browse all 8068

Trending Articles