use of com.applozic.mobicomkit.api.notification.NotificationService in project Applozic-Android-SDK by AppLozic.
the class BroadcastService method sendNotificationBroadcast.
public static void sendNotificationBroadcast(Context context, Message message, int index) {
if (message != null) {
if (ALSpecificSettings.getInstance(context).isAllNotificationMuted() || message.getMetadata() != null && message.getMetadata().containsKey("NO_ALERT") && "true".equals(message.getMetadata().get("NO_ALERT"))) {
return;
}
int notificationId = Utils.getLauncherIcon(context.getApplicationContext());
final NotificationService notificationService = new NotificationService(notificationId, context, 0, 0, 0);
if (MobiComUserPreference.getInstance(context).isLoggedIn()) {
Channel channel = ChannelService.getInstance(context).getChannelInfo(message.getGroupId());
Contact contact = null;
if (message.getConversationId() != null) {
ConversationService.getInstance(context).getConversation(message.getConversationId());
}
if (message.getGroupId() == null) {
contact = new AppContactService(context).getContactById(message.getContactIds());
}
if (ApplozicClient.getInstance(context).isNotificationStacking()) {
notificationService.notifyUser(contact, channel, message, index);
} else {
notificationService.notifyUserForNormalMessage(contact, channel, message, index);
}
}
}
}
Aggregations