{
result r = E_SUCCESS;
int badgeNumber = 0;
+ String badgeValue;
String alertText;
+ SysLog(NID_MSG, "Set notification with message[%ls]", message.GetPointer());
+
r = __notiMessage.SetAppMessage(__text);
StringTokenizer tokens(message, _PUSH_MESSAGE_TOKEN_DELIMITER);
String token;
String key;
String value;
- String badgeValue;
int delimiterIndex;
tokens.GetNextToken(token);
if (IsFailed(r))
continue;
- if (badgeValue.Equals(_PUSH_MESSAGE_VALUE_BADGE_SET, false) == true)
- {
- r = __notiMessage.SetBadgeNumber(badgeNumber);
- if (IsFailed(r))
- continue;
- }
- else if (badgeValue.Equals(_PUSH_MESSAGE_VALUE_BADGE_INCREASE, false) == true)
- {
- r = __notiMessage.SetBadgeOffset(badgeNumber);
- if (IsFailed(r))
- continue;
- }
- else if (badgeValue.Equals(_PUSH_MESSAGE_VALUE_BADGE_DECREASE, false) == true)
+ if (badgeNumber < 0)
{
- r = __notiMessage.SetBadgeOffset(badgeNumber);
- if (IsFailed(r))
- continue;
+ SysLog(NID_MSG, "badgeNumber[%d] is negative, so treat it as '0'", badgeNumber);
+ badgeNumber = 0;
}
- else
+
+ if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
{
- r = __notiMessage.SetBadgeOffset(0);
- if (IsFailed(r))
- continue;
+ SysLog(NID_MSG, "badgeNumber[%d] is out of range, so treat it as '%d'", badgeNumber, MAX_NOTIFICATION_BADGE_NUMBER);
+ badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
}
}
else if (key.Equals(_PUSH_MESSAGE_KEY_ACTION, false) == true)
}
}
+
+ if (badgeValue.Equals(_PUSH_MESSAGE_VALUE_BADGE_SET, false) == true)
+ {
+ r = __notiMessage.SetBadgeNumber(badgeNumber);
+ SysLog(NID_MSG, "Set badgeNumber[%d] result[%s]", badgeNumber, GetErrorMessage(r));
+ }
+ else if (badgeValue.Equals(_PUSH_MESSAGE_VALUE_BADGE_INCREASE, false) == true)
+ {
+ r = __notiMessage.SetBadgeOffset(badgeNumber);
+ SysLog(NID_MSG, "Set badgeOffset[%d] result[%s]", badgeNumber, GetErrorMessage(r));
+ }
+ else if (badgeValue.Equals(_PUSH_MESSAGE_VALUE_BADGE_DECREASE, false) == true)
+ {
+ r = __notiMessage.SetBadgeOffset(-badgeNumber);
+ SysLog(NID_MSG, "Set badgeOffset[%d] result[%s]", badgeNumber, GetErrorMessage(r));
+ }
+
SysLog(NID_MSG, "The converted value of action is [%d].", __pushAction);
SysLog(NID_MSG, "The converted value of badgeOffset is [%d], badgeNumber is [%d].", __notiMessage.GetBadgeOffset(), __notiMessage.GetBadgeNumber());
SysLog(NID_MSG, "The converted value of alertText is [%ls], appMessage is [%ls].", (__notiMessage.GetAlertText()).GetPointer(), (__notiMessage.GetAppMessage()).GetPointer());