Search in sources :

Example 1 with NotificationService

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);
            }
        }
    }
}
Also used : AppContactService(com.applozic.mobicomkit.contact.AppContactService) Channel(com.applozic.mobicommons.people.channel.Channel) NotificationService(com.applozic.mobicomkit.api.notification.NotificationService) Contact(com.applozic.mobicommons.people.contact.Contact)

Aggregations

NotificationService (com.applozic.mobicomkit.api.notification.NotificationService)1 AppContactService (com.applozic.mobicomkit.contact.AppContactService)1 Channel (com.applozic.mobicommons.people.channel.Channel)1 Contact (com.applozic.mobicommons.people.contact.Contact)1