//class AlarmManager ////////////////////////////////////////////////////
AlarmManager.prototype.add = function() {
- var args = AV.validateMethod(arguments, [
+ var args = AV.validateArgs(arguments, [
{
name: 'alarm',
type: AV.Types.PLATFORM_OBJECT,
callArgs.seconds = Converter.toString(seconds);
callArgs.isPeriodSet = !T.isNullOrUndefined(args.alarm.period);
- var result = native.callSync('AlarmManager_add', callArgs);
+ var result = native.callSync('AlarmManagerAdd', callArgs);
if (native.isFailure(result)) {
throw native.getErrorObject(result);
} else {
};
AlarmManager.prototype.addAlarmNotification = function() {
- var args = AV.validateMethod(arguments, [
+ var args = AV.validateArgs(arguments, [
{
name: 'alarm',
type: AV.Types.PLATFORM_OBJECT,
//add marker for UserNotification implementation
callArgs.newImpl = callArgs.notification instanceof tizen.UserNotification;
- var result = native.callSync('AlarmManager_addAlarmNotification', callArgs);
+ var result = native.callSync('AlarmManagerAddAlarmNotification', callArgs);
if (native.isFailure(result)) {
throw native.getErrorObject(result);
} else {
};
AlarmManager.prototype.remove = function() {
- var args = AV.validateMethod(arguments, [
+ var args = AV.validateArgs(arguments, [
{
name: 'id',
type: AV.Types.STRING
}
]);
- var result = native.callSync('AlarmManager_remove', { id: Number(args.id) });
+ var result = native.callSync('AlarmManagerRemove', { id: Number(args.id) });
if (native.isFailure(result)) {
throw native.getErrorObject(result);
};
AlarmManager.prototype.removeAll = function() {
- var result = native.callSync('AlarmManager_removeAll', {});
+ var result = native.callSync('AlarmManagerRemoveAll', {});
if (native.isFailure(result)) {
throw native.getErrorObject(result);
};
AlarmManager.prototype.get = function() {
- var args = AV.validateMethod(arguments, [
+ var args = AV.validateArgs(arguments, [
{
name: 'id',
type: AV.Types.STRING
}
]);
- var result = native.callSync('AlarmManager_get', { id: Number(args.id) });
+ var result = native.callSync('AlarmManagerGet', { id: Number(args.id) });
if (native.isFailure(result)) {
throw native.getErrorObject(result);
result.period,
InternalData_(result)
);
- } else {
+ } else if ('AlarmAbsolute' === result.type) {
var date = new Date(
result.year,
result.month,
);
alarm = new tizen.AlarmAbsolute(date, result.second, InternalData_(result));
+ } else {
+ alarm = new Alarm(InternalData_(result));
}
_warningLogs.allow();
return alarm;
function _prepareDetailInfo(noti) {
if (!noti || !noti.textContents || !noti.textContents.detailInfo) {
- console.log('Do nothing - detailInfo is NOT present');
+ privUtils_.log('Do nothing - detailInfo is NOT present');
return;
}
var detailInfo = noti.textContents.detailInfo;
}
AlarmManager.prototype.getAlarmNotification = function() {
- var args = AV.validateMethod(arguments, [
+ var args = AV.validateArgs(arguments, [
{
name: 'id',
type: AV.Types.STRING
}
]);
- var result = native.callSync('AlarmManager_getAlarmNotification', {
+ var result = native.callSync('AlarmManagerGetAlarmNotification', {
id: Number(args.id)
});
};
AlarmManager.prototype.getAll = function() {
- var result = native.callSync('AlarmManager_getAll', {});
+ var result = native.callSync('AlarmManagerGetAll', {});
if (native.isFailure(result)) {
throw native.getErrorObject(result);
data.forEach(function(i) {
if ('AlarmRelative' === i.type) {
md.push(new tizen.AlarmRelative(i.delay, i.period, InternalData_(i)));
- } else {
+ } else if ('AlarmAbsolute' === i.type) {
var date = new Date(i.year, i.month, i.day, i.hour, i.min, i.sec);
md.push(new tizen.AlarmAbsolute(date, i.second, InternalData_(i)));
+ } else {
+ md.push(new Alarm(InternalData_(i)));
}
});
_warningLogs.allow();
tizen.AlarmRelative.prototype.constructor = tizen.AlarmRelative;
tizen.AlarmRelative.prototype.getRemainingSeconds = function() {
- var result = native.callSync('AlarmRelative_getRemainingSeconds', {
+ var result = native.callSync('AlarmManagerGetRemainingSeconds', {
id: Number(this.id)
});
if (_warningLogs.enableLog && isAlarmAbsolutePeriodDeprecated) {
privUtils_.warn(
'Since Tizen 4.0 constructor AlarmAbsolute(Date date, ' +
- 'long period) is deprecated, thus period attribute ' +
- 'should not be used.'
+ 'long period) is deprecated, thus period attribute should ' +
+ 'not be used.'
);
}
return m_period;
if (_warningLogs.enableLog && isAlarmAbsolutePeriodDeprecated) {
privUtils_.warn(
'Since Tizen 4.0 constructor AlarmAbsolute(Date date, ' +
- 'long period) is deprecated, thus period attribute ' +
- 'should not be used.'
+ 'long period) is deprecated, thus period attribute should ' +
+ 'not be used.'
);
}
tizen.AlarmAbsolute.prototype.constructor = tizen.AlarmAbsolute;
tizen.AlarmAbsolute.prototype.getNextScheduledDate = function() {
- var result = native.callSync('AlarmAbsolute_getNextScheduledDate', {
+ var result = native.callSync('AlarmManagerGetNextScheduledDate', {
id: Number(this.id)
});
var _profile = ProfileAlarm.getInstance().profile;
// Notifications feature are available on mobile and wearable profile
-if (_profile != 'mobile' && _profile != 'wearable') {
+if (_profile != 'mobile' && _profile != 'wearable' && _profile != 'common') {
delete AlarmManager.prototype.addAlarmNotification;
delete AlarmManager.prototype.getAlarmNotification;
isAlarmAbsolutePeriodDeprecated = false;